kopia lustrzana https://github.com/snarfed/bridgy-fed
drop AP tests for mentions, they're already tested in test_protocol
rodzic
7fc83284f7
commit
d4d5bff81b
|
@ -709,70 +709,6 @@ class ActivityPubTest(TestCase):
|
|||
self.assertIsNone(Object.get_by_id(not_public['id']))
|
||||
self.assertIsNone(Object.get_by_id(not_public['object']['id']))
|
||||
|
||||
def test_inbox_mention_object(self, *mocks):
|
||||
self._test_inbox_mention(
|
||||
MENTION_OBJECT,
|
||||
{
|
||||
'type': 'note', # not mention (?)
|
||||
'labels': ['notification'],
|
||||
},
|
||||
*mocks,
|
||||
)
|
||||
|
||||
def test_inbox_mention_create_activity(self, *mocks):
|
||||
self._test_inbox_mention(
|
||||
MENTION,
|
||||
{
|
||||
'type': 'post', # not mention (?)
|
||||
'object_ids': [MENTION_OBJECT['id']],
|
||||
'labels': ['notification', 'activity'],
|
||||
},
|
||||
*mocks,
|
||||
)
|
||||
|
||||
# redirect unwrap
|
||||
expected_as2 = copy.deepcopy(MENTION_OBJECT)
|
||||
expected_as2['tag'][1]['href'] = 'https://tar.get/'
|
||||
self.assert_object(MENTION_OBJECT['id'],
|
||||
source_protocol='activitypub',
|
||||
our_as1=as2.to_as1(expected_as2),
|
||||
type='note')
|
||||
|
||||
def _test_inbox_mention(self, mention, expected_props, mock_head, mock_get, mock_post):
|
||||
self.make_user('tar.get')
|
||||
|
||||
mock_get.side_effect = [
|
||||
self.as2_resp(ACTOR),
|
||||
requests_response(test_web.NOTE_HTML),
|
||||
requests_response(test_web.NOTE_HTML),
|
||||
WEBMENTION_DISCOVERY,
|
||||
]
|
||||
mock_post.return_value = requests_response()
|
||||
|
||||
got = self.post('/user.com/inbox', json=mention)
|
||||
self.assertEqual(200, got.status_code, got.get_data(as_text=True))
|
||||
self.assert_req(mock_get, 'https://tar.get/')
|
||||
convert_id = mention['id'].replace('://', ':/')
|
||||
self.assert_req(
|
||||
mock_post,
|
||||
'https://tar.get/webmention',
|
||||
headers={'Accept': '*/*'},
|
||||
allow_redirects=False,
|
||||
data={
|
||||
'source': f'http://localhost/convert/activitypub/web/{convert_id}',
|
||||
'target': 'https://tar.get/',
|
||||
},
|
||||
)
|
||||
|
||||
expected_as2 = common.redirect_unwrap(mention)
|
||||
self.assert_object(mention['id'],
|
||||
users=[Web(id='tar.get').key],
|
||||
source_protocol='activitypub',
|
||||
status='complete',
|
||||
as2=expected_as2,
|
||||
delivered=['https://tar.get/'],
|
||||
**expected_props)
|
||||
|
||||
def test_inbox_like(self, mock_head, mock_get, mock_post):
|
||||
mock_head.return_value = requests_response(url='https://user.com/post')
|
||||
mock_get.side_effect = [
|
||||
|
|
Ładowanie…
Reference in New Issue