From 0a554b002d39a2e01fa084cf4a293dd7be93f47c Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 9 Feb 2021 10:43:40 -0800 Subject: [PATCH] Fixes test for handling direct recipients --- bookwyrm/tests/models/test_activitypub_mixin.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/bookwyrm/tests/models/test_activitypub_mixin.py b/bookwyrm/tests/models/test_activitypub_mixin.py index 2d2e0ee18..67ff61fd5 100644 --- a/bookwyrm/tests/models/test_activitypub_mixin.py +++ b/bookwyrm/tests/models/test_activitypub_mixin.py @@ -139,10 +139,8 @@ class ActivitypubMixins(TestCase): inbox='https://example.com/users/nutria/inbox', outbox='https://example.com/users/nutria/outbox', ) - MockMentions = namedtuple('Mentions', ('all')) - mock_mentions = MockMentions(lambda: [another_remote_user]) - MockSelf = namedtuple('Self', ('privacy', 'user', 'mention_users')) - mock_self = MockSelf('public', self.local_user, mock_mentions) + MockSelf = namedtuple('Self', ('privacy', 'user', 'recipients')) + mock_self = MockSelf('public', self.local_user, [another_remote_user]) recipients = ActivitypubMixin.get_recipients(mock_self) self.assertEqual(len(recipients), 2) @@ -163,10 +161,8 @@ class ActivitypubMixins(TestCase): inbox='https://example.com/users/nutria/inbox', outbox='https://example.com/users/nutria/outbox', ) - MockMentions = namedtuple('Mentions', ('all')) - mock_mentions = MockMentions(lambda: [another_remote_user]) - MockSelf = namedtuple('Self', ('privacy', 'user', 'mention_users')) - mock_self = MockSelf('direct', self.local_user, mock_mentions) + MockSelf = namedtuple('Self', ('privacy', 'user', 'recipients')) + mock_self = MockSelf('direct', self.local_user, [another_remote_user]) recipients = ActivitypubMixin.get_recipients(mock_self) self.assertEqual(len(recipients), 1) @@ -238,10 +234,10 @@ class ActivitypubMixins(TestCase): def save(self, *args, **kwargs): with patch('django.db.models.Model.save'): super().save(*args, **kwargs) - def broadcast(self, activity, sender): + def broadcast(self, activity, sender):#pylint: disable=arguments-differ ''' do something ''' raise Success() - def to_create_activity(self, user): + def to_create_activity(self, user):#pylint: disable=arguments-differ return {} with self.assertRaises(Success):