kopia lustrzana https://github.com/snarfed/bridgy-fed
webfinger: misc noop comment and test tweaks
rodzic
a4fede524f
commit
17fa355226
|
@ -1,7 +1,9 @@
|
|||
# coding=utf-8
|
||||
"""Unit tests for webfinger.py.
|
||||
|
||||
TODO: test error handling
|
||||
to test:
|
||||
* user URL that redirects
|
||||
* error handling
|
||||
"""
|
||||
from unittest import mock
|
||||
import urllib.parse
|
||||
|
@ -17,8 +19,6 @@ import models
|
|||
from webfinger import UserHandler, WebfingerHandler
|
||||
from . import testutil
|
||||
|
||||
USER = 'foo.com@foo.com'
|
||||
|
||||
|
||||
class WebfingerTest(testutil.TestCase):
|
||||
|
||||
|
@ -36,7 +36,7 @@ class WebfingerTest(testutil.TestCase):
|
|||
"""
|
||||
self.key = models.MagicKey.get_or_create('foo.com')
|
||||
self.expected_webfinger = {
|
||||
'subject': 'acct:' + USER,
|
||||
'subject': 'acct:foo.com@foo.com',
|
||||
'aliases': [
|
||||
'https://foo.com/about-me',
|
||||
'https://foo.com/',
|
||||
|
@ -78,9 +78,6 @@ class WebfingerTest(testutil.TestCase):
|
|||
}, {
|
||||
'rel': 'salmon',
|
||||
'href': 'http://localhost/foo.com/salmon'
|
||||
# }, {
|
||||
# 'rel': 'http://ostatus.org/schema/1.0/subscribe',
|
||||
# 'template': 'https://mastodon.technology/authorize_follow?acct={uri}'
|
||||
}]
|
||||
}
|
||||
|
||||
|
|
12
webfinger.py
12
webfinger.py
|
@ -4,11 +4,6 @@ https://webfinger.net/
|
|||
https://tools.ietf.org/html/rfc7033
|
||||
|
||||
Largely based on webfinger-unofficial/user.py.
|
||||
|
||||
TODO: test:
|
||||
* /.well-known/webfinger
|
||||
* acct: URI handling
|
||||
* user URL that redirects
|
||||
"""
|
||||
import datetime
|
||||
import logging
|
||||
|
@ -152,6 +147,13 @@ Couldn't find a representative h-card (http://microformats.org/wiki/representati
|
|||
|
||||
|
||||
class WebfingerHandler(UserHandler):
|
||||
"""Handles Webfinger requests.
|
||||
|
||||
https://webfinger.net/
|
||||
|
||||
Supports both JRD and XRD; defaults to JRD.
|
||||
https://tools.ietf.org/html/rfc7033#section-4
|
||||
"""
|
||||
def template_vars(self):
|
||||
resource = util.get_required_param(self, 'resource')
|
||||
try:
|
||||
|
|
Ładowanie…
Reference in New Issue