mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-01-10 17:25:35 +00:00
More mocks
This commit is contained in:
parent
46421f9672
commit
6e70ceb094
4 changed files with 18 additions and 10 deletions
|
@ -32,9 +32,10 @@ class ListsStreamSignals(TestCase):
|
|||
|
||||
def test_add_list_on_create_command(self, _):
|
||||
"""a new lists has entered"""
|
||||
book_list = models.List.objects.create(
|
||||
user=self.remote_user, name="hi", privacy="public"
|
||||
)
|
||||
with patch("bookwyrm.lists_stream.remove_list_task.delay"):
|
||||
book_list = models.List.objects.create(
|
||||
user=self.remote_user, name="hi", privacy="public"
|
||||
)
|
||||
with patch("bookwyrm.lists_stream.add_list_task.delay") as mock:
|
||||
lists_stream.add_list_on_create_command(book_list.id)
|
||||
self.assertEqual(mock.call_count, 1)
|
||||
|
@ -43,9 +44,10 @@ class ListsStreamSignals(TestCase):
|
|||
|
||||
def test_remove_list_on_delete(self, _):
|
||||
"""delete a list"""
|
||||
book_list = models.List.objects.create(
|
||||
user=self.remote_user, name="hi", privacy="public"
|
||||
)
|
||||
with patch("bookwyrm.lists_stream.remove_list_task.delay"):
|
||||
book_list = models.List.objects.create(
|
||||
user=self.remote_user, name="hi", privacy="public"
|
||||
)
|
||||
with patch("bookwyrm.lists_stream.remove_list_task.delay") as mock:
|
||||
lists_stream.remove_list_on_delete(models.List, book_list)
|
||||
args = mock.call_args[0]
|
||||
|
|
|
@ -11,6 +11,7 @@ from bookwyrm import lists_stream, models
|
|||
@patch("bookwyrm.activitystreams.add_book_statuses_task.delay")
|
||||
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
|
||||
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
|
||||
@patch("bookwyrm.lists_stream.remove_list_task.delay")
|
||||
class ListsStream(TestCase):
|
||||
"""using redis to build activity streams"""
|
||||
|
||||
|
|
|
@ -35,7 +35,9 @@ class Activitystreams(TestCase):
|
|||
inbox="https://example.com/users/rat/inbox",
|
||||
outbox="https://example.com/users/rat/outbox",
|
||||
)
|
||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.apply_async"):
|
||||
with patch(
|
||||
"bookwyrm.models.activitypub_mixin.broadcast_task.apply_async"
|
||||
), patch("bookwyrm.lists_stream.remove_list_task.delay"):
|
||||
self.list = models.List.objects.create(
|
||||
user=self.local_user, name="hi", privacy="public"
|
||||
)
|
||||
|
|
|
@ -80,7 +80,9 @@ class Group(TestCase):
|
|||
"""follower-only group booklists should not be excluded from group booklist
|
||||
listing for group members who do not follower list owner"""
|
||||
|
||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.apply_async"):
|
||||
with patch(
|
||||
"bookwyrm.models.activitypub_mixin.broadcast_task.apply_async"
|
||||
), patch("bookwyrm.lists_stream.remove_list_task.delay"):
|
||||
followers_list = models.List.objects.create(
|
||||
name="Followers List",
|
||||
curation="group",
|
||||
|
@ -101,8 +103,9 @@ class Group(TestCase):
|
|||
"""private group booklists should not be excluded from group booklist listing
|
||||
for group members"""
|
||||
|
||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.apply_async"):
|
||||
|
||||
with patch(
|
||||
"bookwyrm.models.activitypub_mixin.broadcast_task.apply_async"
|
||||
), patch("bookwyrm.lists_stream.remove_list_task.delay"):
|
||||
private_list = models.List.objects.create(
|
||||
name="Private List",
|
||||
privacy="direct",
|
||||
|
|
Loading…
Reference in a new issue