fix tests for 3dd265d (AS2/AP tweaks for Mastodon)

pull/27/head
Ryan Barrett 2017-09-26 07:54:37 -07:00
rodzic 3dd265d741
commit b8bdde7cef
2 zmienionych plików z 7 dodań i 6 usunięć

Wyświetl plik

@ -99,6 +99,7 @@ class WebmentionTest(testutil.TestCase):
'@type': 'Create',
'type': 'Create',
'object': {
'@context': 'https://www.w3.org/ns/activitystreams',
'@type': 'Note',
'type': 'Note',
'url': 'http://a/reply',

Wyświetl plik

@ -31,8 +31,8 @@ import models
def prepare_as2(activity):
"""Prepare an AS2 object to be sent via ActivityPub."""
activity.update({
'type': activity['@type'], # for Mastodon
'id': activity['@id'], # "
'type': activity.get('@type'), # for Mastodon
'id': activity.get('@id'), # "
'cc': (activity.get('cc', []) +
[activitypub.PUBLIC_AUDIENCE] +
util.get_list(activity, 'inReplyTo')),
@ -50,16 +50,16 @@ def prepare_as2(activity):
'Only using the first: %s' % in_reply_tos[0])
activity['inReplyTo'] = in_reply_tos[0]
if activity.get('@type') in as2.TYPE_TO_VERB:
return activity
else:
return {
if activity.get('@type') not in as2.TYPE_TO_VERB:
activity = {
'@context': as2.CONTEXT,
'@type': 'Create',
'type': 'Create',
'object': activity,
}
return util.trim_nulls(activity)
class WebmentionHandler(webapp2.RequestHandler):
"""Handles inbound webmention, converts to ActivityPub or Salmon."""