kopia lustrzana https://github.com/snarfed/bridgy-fed
webfinger: add self, salmon links
rodzic
f0fe11dc9a
commit
96df69025e
|
@ -95,17 +95,17 @@ class WebFingerTest(unittest.TestCase):
|
|||
'rel': 'http://webfinger.net/rel/profile-page',
|
||||
'type': 'text/html',
|
||||
'href': 'https://foo.com/'
|
||||
}, {
|
||||
'rel': 'http://webfinger.net/rel/avatar',
|
||||
'href': 'https://foo.com/me.jpg'
|
||||
}, {
|
||||
'rel': 'magic-public-key',
|
||||
'href': key.href(),
|
||||
}, {
|
||||
'rel': 'salmon',
|
||||
'href': 'http://localhost/@foo.com/salmon'
|
||||
# TODO
|
||||
# }, {
|
||||
# 'rel': 'http://webfinger.net/rel/avatar',
|
||||
# 'href': 'https://foo.com/me.jpg'
|
||||
# }, {
|
||||
# 'rel': 'salmon',
|
||||
# 'href': 'http://localhost/salmon/23507'
|
||||
# }, {
|
||||
# 'rel': 'http://schemas.google.com/g/2010#updates-from',
|
||||
# 'type': 'application/atom+xml',
|
||||
# 'href': 'https://mastodon.technology/users/snarfed.atom'
|
||||
|
@ -123,7 +123,9 @@ class WebFingerTest(unittest.TestCase):
|
|||
again = json.loads(app.get_response(
|
||||
'/@foo.com', headers={'Accept': 'application/json'}).body)
|
||||
self.assertEquals(key.href(), again['magic_keys'][0]['value'])
|
||||
self.assertEquals(key.href(), again['links'][2]['href'])
|
||||
|
||||
links = {l['rel']: l['href'] for l in again['links']}
|
||||
self.assertEquals(key.href(), links['magic-public-key'])
|
||||
|
||||
@mock.patch('requests.get')
|
||||
def test_user_handler_no_hcard(self, mock_get):
|
||||
|
|
|
@ -45,7 +45,6 @@ representative h-card</a> on %s""" % resp.url)
|
|||
props = hcard.get('properties', {})
|
||||
urls = util.dedupe_urls(props.get('url', []) + [resp.url])
|
||||
|
||||
# appengine_config.HOST
|
||||
return util.trim_nulls({
|
||||
'subject': 'acct:' + uri,
|
||||
'aliases': urls,
|
||||
|
@ -57,9 +56,12 @@ representative h-card</a> on %s""" % resp.url)
|
|||
} for url in urls] + [{
|
||||
'rel': 'http://webfinger.net/rel/avatar',
|
||||
'href': url,
|
||||
} for url in props.get('photos', [])] + [{
|
||||
} for url in props.get('photo', [])] + [{
|
||||
'rel': 'magic-public-key',
|
||||
'href': key.href(),
|
||||
}, {
|
||||
'rel': 'salmon',
|
||||
'href': '%s/@foo.com/salmon' % self.request.host_url
|
||||
}]
|
||||
})
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue