Updates tests

This commit is contained in:
Mouse Reeve 2022-01-06 12:10:36 -08:00
parent 6168ce91b3
commit 8722778ed0
4 changed files with 8 additions and 19 deletions

View file

@ -62,11 +62,11 @@ class ActivitystreamsSignals(TestCase):
self.assertEqual(args["args"][0], status.id)
self.assertEqual(args["queue"], "high_priority")
def test_populate_streams_on_account_create(self, *_):
def test_populate_streams_on_account_create_command(self, *_):
"""create streams for a user"""
with patch("bookwyrm.activitystreams.populate_stream_task.delay") as mock:
activitystreams.populate_streams_on_account_create(
models.User, self.local_user, True
activitystreams.populate_streams_on_account_create_command(
self.local_user.id
)
self.assertEqual(mock.call_count, 3)
args = mock.call_args[0]

View file

@ -36,7 +36,7 @@ class ListsStreamSignals(TestCase):
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)
lists_stream.add_list_on_create_command(book_list.id)
self.assertEqual(mock.call_count, 1)
args = mock.call_args[0]
self.assertEqual(args[0], book_list.id)
@ -51,12 +51,10 @@ class ListsStreamSignals(TestCase):
args = mock.call_args[0]
self.assertEqual(args[0], book_list.id)
def test_populate_lists_on_account_create(self, _):
def test_populate_lists_on_account_create_command(self, _):
"""create streams for a user"""
with patch("bookwyrm.lists_stream.populate_lists_task.delay") as mock:
lists_stream.populate_lists_on_account_create(
models.User, self.local_user, True
)
lists_stream.populate_lists_on_account_create_command(self.local_user.id)
self.assertEqual(mock.call_count, 1)
args = mock.call_args[0]
self.assertEqual(args[0], self.local_user.id)

View file

@ -42,13 +42,13 @@ class Activitystreams(TestCase):
def test_populate_lists_task(self, *_):
"""populate lists cache"""
with patch("bookwyrm.lists_stream.ListsStream.populate_streams") as mock:
with patch("bookwyrm.lists_stream.ListsStream.populate_lists") as mock:
lists_stream.populate_lists_task(self.local_user.id)
self.assertTrue(mock.called)
args = mock.call_args[0]
self.assertEqual(args[0], self.local_user)
with patch("bookwyrm.lists_stream.ListsStream.populate_streams") as mock:
with patch("bookwyrm.lists_stream.ListsStream.populate_lists") as mock:
lists_stream.populate_lists_task(self.local_user.id)
self.assertTrue(mock.called)
args = mock.call_args[0]

View file

@ -236,12 +236,3 @@ class SuggestedUsers(TestCase):
)
user_1_annotated = result.get(id=user_1.id)
self.assertEqual(user_1_annotated.mutuals, 3)
def test_create_user_signal(self, *_):
"""build suggestions for new users"""
with patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") as mock:
models.User.objects.create_user(
"nutria", "nutria@nu.tria", "password", local=True, localname="nutria"
)
self.assertEqual(mock.call_count, 1)