Updates mocks on list stream tasks

This commit is contained in:
Mouse Reeve 2021-12-14 09:31:57 -08:00
parent 3d6266cca2
commit 3358e45086

View file

@ -4,6 +4,9 @@ from django.test import TestCase
from bookwyrm import lists_stream, models
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
@patch("bookwyrm.activitystreams.remove_user_statuses_task.delay")
@patch("bookwyrm.activitystreams.add_user_statuses_task.delay")
class Activitystreams(TestCase):
"""using redis to build activity streams"""
@ -32,11 +35,12 @@ class Activitystreams(TestCase):
inbox="https://example.com/users/rat/inbox",
outbox="https://example.com/users/rat/outbox",
)
self.list = models.List.objects.create(
user=self.local_user, name="hi", privacy="public"
)
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.apply_async"):
self.list = models.List.objects.create(
user=self.local_user, name="hi", privacy="public"
)
def test_populate_lists_task(self):
def test_populate_lists_task(self, *_):
"""populate lists cache"""
with patch("bookwyrm.lists_stream.ListsStream.populate_streams") as mock:
lists_stream.populate_lists_task(self.local_user.id)
@ -50,7 +54,7 @@ class Activitystreams(TestCase):
args = mock.call_args[0]
self.assertEqual(args[0], self.local_user)
def test_remove_list_task(self):
def test_remove_list_task(self, *_):
"""remove a list from all streams"""
with patch(
"bookwyrm.lists_stream.ListsStream.remove_object_from_related_stores"
@ -60,7 +64,7 @@ class Activitystreams(TestCase):
args = mock.call_args[0]
self.assertEqual(args[0], self.list)
def test_add_list_task(self):
def test_add_list_task(self, *_):
"""add a list to all streams"""
with patch("bookwyrm.lists_stream.ListsStream.add_list") as mock:
lists_stream.add_list_task(self.list.id)
@ -68,7 +72,7 @@ class Activitystreams(TestCase):
args = mock.call_args[0]
self.assertEqual(args[0], self.list)
def test_remove_user_lists_task(self):
def test_remove_user_lists_task(self, *_):
"""remove all lists by a user from another users' feeds"""
with patch("bookwyrm.lists_stream.ListsStream.remove_user_lists") as mock:
lists_stream.remove_user_lists_task(
@ -88,7 +92,7 @@ class Activitystreams(TestCase):
self.assertEqual(args[0], self.local_user)
self.assertEqual(args[1], self.another_user)
def test_add_user_lists_task(self):
def test_add_user_lists_task(self, *_):
"""add a user's lists to another users feeds"""
with patch("bookwyrm.lists_stream.ListsStream.add_user_lists") as mock:
lists_stream.add_user_lists_task(self.local_user.id, self.another_user.id)