minor activitypub bug fix (default http, not https) and test improvements

pull/27/head
Ryan Barrett 2017-08-19 12:29:10 -07:00
rodzic a0e6d0c5d0
commit c1c99c6ca5
2 zmienionych plików z 4 dodań i 2 usunięć

Wyświetl plik

@ -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))

Wyświetl plik

@ -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(