mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-27 20:11:14 +00:00
Fixes test for handling direct recipients
This commit is contained in:
parent
4ad51e62c6
commit
0a554b002d
1 changed files with 6 additions and 10 deletions
|
@ -139,10 +139,8 @@ class ActivitypubMixins(TestCase):
|
||||||
inbox='https://example.com/users/nutria/inbox',
|
inbox='https://example.com/users/nutria/inbox',
|
||||||
outbox='https://example.com/users/nutria/outbox',
|
outbox='https://example.com/users/nutria/outbox',
|
||||||
)
|
)
|
||||||
MockMentions = namedtuple('Mentions', ('all'))
|
MockSelf = namedtuple('Self', ('privacy', 'user', 'recipients'))
|
||||||
mock_mentions = MockMentions(lambda: [another_remote_user])
|
mock_self = MockSelf('public', self.local_user, [another_remote_user])
|
||||||
MockSelf = namedtuple('Self', ('privacy', 'user', 'mention_users'))
|
|
||||||
mock_self = MockSelf('public', self.local_user, mock_mentions)
|
|
||||||
|
|
||||||
recipients = ActivitypubMixin.get_recipients(mock_self)
|
recipients = ActivitypubMixin.get_recipients(mock_self)
|
||||||
self.assertEqual(len(recipients), 2)
|
self.assertEqual(len(recipients), 2)
|
||||||
|
@ -163,10 +161,8 @@ class ActivitypubMixins(TestCase):
|
||||||
inbox='https://example.com/users/nutria/inbox',
|
inbox='https://example.com/users/nutria/inbox',
|
||||||
outbox='https://example.com/users/nutria/outbox',
|
outbox='https://example.com/users/nutria/outbox',
|
||||||
)
|
)
|
||||||
MockMentions = namedtuple('Mentions', ('all'))
|
MockSelf = namedtuple('Self', ('privacy', 'user', 'recipients'))
|
||||||
mock_mentions = MockMentions(lambda: [another_remote_user])
|
mock_self = MockSelf('direct', self.local_user, [another_remote_user])
|
||||||
MockSelf = namedtuple('Self', ('privacy', 'user', 'mention_users'))
|
|
||||||
mock_self = MockSelf('direct', self.local_user, mock_mentions)
|
|
||||||
|
|
||||||
recipients = ActivitypubMixin.get_recipients(mock_self)
|
recipients = ActivitypubMixin.get_recipients(mock_self)
|
||||||
self.assertEqual(len(recipients), 1)
|
self.assertEqual(len(recipients), 1)
|
||||||
|
@ -238,10 +234,10 @@ class ActivitypubMixins(TestCase):
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
with patch('django.db.models.Model.save'):
|
with patch('django.db.models.Model.save'):
|
||||||
super().save(*args, **kwargs)
|
super().save(*args, **kwargs)
|
||||||
def broadcast(self, activity, sender):
|
def broadcast(self, activity, sender):#pylint: disable=arguments-differ
|
||||||
''' do something '''
|
''' do something '''
|
||||||
raise Success()
|
raise Success()
|
||||||
def to_create_activity(self, user):
|
def to_create_activity(self, user):#pylint: disable=arguments-differ
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
with self.assertRaises(Success):
|
with self.assertRaises(Success):
|
||||||
|
|
Loading…
Reference in a new issue