kopia lustrzana https://github.com/snarfed/bridgy-fed
flask: fix test_common, drop unused common.canonicalize_domain decorator
rodzic
b8be570d66
commit
c17cb3394b
|
@ -8,7 +8,7 @@ import urllib.parse
|
|||
|
||||
from flask import request
|
||||
from granary import as2
|
||||
from oauth_dropins.webutil import handlers, util, webmention
|
||||
from oauth_dropins.webutil import util, webmention
|
||||
import requests
|
||||
from webob import exc
|
||||
from werkzeug.exceptions import abort
|
||||
|
@ -65,7 +65,6 @@ OTHER_DOMAINS = (
|
|||
'localhost',
|
||||
)
|
||||
DOMAINS = (PRIMARY_DOMAIN,) + OTHER_DOMAINS
|
||||
canonicalize_domain = handlers.redirect(OTHER_DOMAINS, PRIMARY_DOMAIN)
|
||||
|
||||
|
||||
def not_5xx(resp):
|
||||
|
|
|
@ -8,6 +8,7 @@ from oauth_dropins.webutil.testutil import requests_response
|
|||
import requests
|
||||
from webob import exc
|
||||
|
||||
from app import app
|
||||
import common
|
||||
from . import testutil
|
||||
|
||||
|
@ -62,14 +63,15 @@ class CommonTest(testutil.TestCase):
|
|||
resp = common.get_as2('http://orig')
|
||||
|
||||
def test_redirect_wrap_empty(self):
|
||||
self.assertIsNone(self.handler.redirect_wrap(None))
|
||||
self.assertEqual('', self.handler.redirect_wrap(''))
|
||||
self.assertIsNone(common.redirect_wrap(None))
|
||||
self.assertEqual('', common.redirect_wrap(''))
|
||||
|
||||
def test_postprocess_as2_multiple_in_reply_tos(self):
|
||||
self.assertEqual({
|
||||
'id': 'http://localhost/r/xyz',
|
||||
'inReplyTo': 'foo',
|
||||
}, self.handler.postprocess_as2({
|
||||
'id': 'xyz',
|
||||
'inReplyTo': ['foo', 'bar'],
|
||||
}))
|
||||
with app.test_request_context('/'):
|
||||
self.assertEqual({
|
||||
'id': 'http://localhost/r/xyz',
|
||||
'inReplyTo': 'foo',
|
||||
}, common.postprocess_as2({
|
||||
'id': 'xyz',
|
||||
'inReplyTo': ['foo', 'bar'],
|
||||
}))
|
||||
|
|
Ładowanie…
Reference in New Issue