kopia lustrzana https://github.com/snarfed/bridgy-fed
uncomment remaining test_protocol receive tests so I don't forget them
rodzic
89ff89ef30
commit
e20ef91afe
|
@ -852,67 +852,67 @@ class ProtocolReceiveTest(TestCase):
|
||||||
|
|
||||||
self.assertEqual([(update_obj, 'shared:target')], Fake.sent)
|
self.assertEqual([(update_obj, 'shared:target')], Fake.sent)
|
||||||
|
|
||||||
# def test_mention_object(self, *mocks):
|
def test_mention_object(self, *mocks):
|
||||||
# self._test_mention(
|
self._test_mention(
|
||||||
# MENTION_OBJECT,
|
MENTION_OBJECT,
|
||||||
# {
|
{
|
||||||
# 'type': 'note', # not mention (?)
|
'type': 'note', # not mention (?)
|
||||||
# 'labels': ['notification'],
|
'labels': ['notification'],
|
||||||
# },
|
},
|
||||||
# *mocks,
|
*mocks,
|
||||||
# )
|
)
|
||||||
|
|
||||||
# def test_mention_create_activity(self, *mocks):
|
def test_mention_create_activity(self, *mocks):
|
||||||
# self._test_mention(
|
self._test_mention(
|
||||||
# MENTION,
|
MENTION,
|
||||||
# {
|
{
|
||||||
# 'type': 'post', # not mention (?)
|
'type': 'post', # not mention (?)
|
||||||
# 'object_ids': [MENTION_OBJECT['id']],
|
'object_ids': [MENTION_OBJECT['id']],
|
||||||
# 'labels': ['notification', 'activity'],
|
'labels': ['notification', 'activity'],
|
||||||
# },
|
},
|
||||||
# *mocks,
|
*mocks,
|
||||||
# )
|
)
|
||||||
|
|
||||||
# # redirect unwrap
|
# redirect unwrap
|
||||||
# expected_as2 = copy.deepcopy(MENTION_OBJECT)
|
expected_as2 = copy.deepcopy(MENTION_OBJECT)
|
||||||
# expected_as2['tag'][1]['href'] = 'https://tar.get/'
|
expected_as2['tag'][1]['href'] = 'https://tar.get/'
|
||||||
# self.assert_object(MENTION_OBJECT['id'],
|
self.assert_object(MENTION_OBJECT['id'],
|
||||||
# as2=expected_as2,
|
as2=expected_as2,
|
||||||
# type='note')
|
type='note')
|
||||||
|
|
||||||
# def _test_mention(self, mention, expected_props):
|
def _test_mention(self, mention, expected_props):
|
||||||
# self.make_user('tar.get')
|
self.make_user('tar.get')
|
||||||
|
|
||||||
# mock_get.side_effect = [
|
mock_get.side_effect = [
|
||||||
# self.as2_resp(ACTOR),
|
self.as2_resp(ACTOR),
|
||||||
# requests_response(test_web.NOTE_HTML),
|
requests_response(test_web.NOTE_HTML),
|
||||||
# requests_response(test_web.NOTE_HTML),
|
requests_response(test_web.NOTE_HTML),
|
||||||
# WEBMENTION_DISCOVERY,
|
WEBMENTION_DISCOVERY,
|
||||||
# ]
|
]
|
||||||
# mock_post.return_value = requests_response()
|
mock_post.return_value = requests_response()
|
||||||
|
|
||||||
# got = self.post('/user.com/inbox', json=mention)
|
got = self.post('/user.com/inbox', json=mention)
|
||||||
# self.assertEqual(200, got.status_code, got.get_data(as_text=True))
|
self.assertEqual(200, got.status_code, got.get_data(as_text=True))
|
||||||
# self.assert_req(mock_get, 'https://tar.get/')
|
self.assert_req(mock_get, 'https://tar.get/')
|
||||||
# convert_id = mention['id'].replace('://', ':/')
|
convert_id = mention['id'].replace('://', ':/')
|
||||||
# self.assert_req(
|
self.assert_req(
|
||||||
# mock_post,
|
mock_post,
|
||||||
# 'https://tar.get/webmention',
|
'https://tar.get/webmention',
|
||||||
# headers={'Accept': '*/*'},
|
headers={'Accept': '*/*'},
|
||||||
# allow_redirects=False,
|
allow_redirects=False,
|
||||||
# data={
|
data={
|
||||||
# 'source': f'http://localhost/convert/activitypub/web/{convert_id}',
|
'source': f'http://localhost/convert/activitypub/web/{convert_id}',
|
||||||
# 'target': 'https://tar.get/',
|
'target': 'https://tar.get/',
|
||||||
# },
|
},
|
||||||
# )
|
)
|
||||||
|
|
||||||
# expected_as2 = common.redirect_unwrap(mention)
|
expected_as2 = common.redirect_unwrap(mention)
|
||||||
# self.assert_object(mention['id'],
|
self.assert_object(mention['id'],
|
||||||
# users=[Web(id='tar.get').key],
|
users=[Web(id='tar.get').key],
|
||||||
# status='complete',
|
status='complete',
|
||||||
# as2=expected_as2,
|
as2=expected_as2,
|
||||||
# delivered=['https://tar.get/'],
|
delivered=['https://tar.get/'],
|
||||||
# **expected_props)
|
**expected_props)
|
||||||
|
|
||||||
def test_follow(self):
|
def test_follow(self):
|
||||||
self._test_follow()
|
self._test_follow()
|
||||||
|
@ -1061,5 +1061,5 @@ class ProtocolReceiveTest(TestCase):
|
||||||
self.assertIsNone(Object.get_by_id('foo'))
|
self.assertIsNone(Object.get_by_id('foo'))
|
||||||
self.assertIsNone(Object.get_by_id('https://ap.brid.gy/user.com'))
|
self.assertIsNone(Object.get_by_id('https://ap.brid.gy/user.com'))
|
||||||
|
|
||||||
# def test_skip_same_domain_target(self):
|
def test_skip_same_domain_target(self):
|
||||||
# TODO
|
TODO
|
||||||
|
|
Ładowanie…
Reference in New Issue