kopia lustrzana https://github.com/snarfed/bridgy-fed
minor activitypub bug fix (default http, not https) and test improvements
rodzic
a0e6d0c5d0
commit
c1c99c6ca5
|
|
@ -27,7 +27,7 @@ class ActorHandler(webapp2.RequestHandler):
|
|||
"""Serves /[DOMAIN], fetches its mf2, converts to AS Actor, and serves it."""
|
||||
|
||||
def get(self, domain):
|
||||
url = 'https://%s/' % domain
|
||||
url = 'http://%s/' % domain
|
||||
resp = common.requests_get(url)
|
||||
mf2 = mf2py.parse(resp.text, url=resp.url)
|
||||
logging.info('Parsed mf2 for %s: %s', resp.url, json.dumps(mf2, indent=2))
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ class ActivityPubTest(unittest.TestCase):
|
|||
mock_get.return_value = resp
|
||||
|
||||
got = app.get_response('/foo.com')
|
||||
mock_get.assert_called_once_with('http://foo.com/', headers=common.HEADERS)
|
||||
self.assertEquals(200, got.status_int)
|
||||
self.assertEquals(activitypub.CONTENT_TYPE_AS2, got.headers['Content-Type'])
|
||||
self.assertEquals({
|
||||
|
|
@ -49,7 +50,6 @@ class ActivityPubTest(unittest.TestCase):
|
|||
resp.status_code = 200
|
||||
resp._text = html
|
||||
resp._content = html.encode('utf-8')
|
||||
resp.url = 'https://foo.com/'
|
||||
mock_get.return_value = resp
|
||||
|
||||
resp = requests.Response()
|
||||
|
|
@ -65,6 +65,8 @@ class ActivityPubTest(unittest.TestCase):
|
|||
'inReplyTo': 'http://orig/post',
|
||||
'cc': ['https://www.w3.org/ns/activitystreams#Public'],
|
||||
}))
|
||||
mock_get.assert_called_once_with(
|
||||
'http://orig/post', headers=common.HEADERS, verify=False)
|
||||
self.assertEquals(200, got.status_int)
|
||||
|
||||
mock_post.assert_called_once_with(
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue