Fixes references to populate lists task

This commit is contained in:
Mouse Reeve 2021-12-10 09:34:17 -08:00
parent 94250dab42
commit f7c8a550cf
4 changed files with 7 additions and 5 deletions

View File

@ -13,7 +13,7 @@ def populate_lists_streams():
print("This may take a long time! Please be patient.") print("This may take a long time! Please be patient.")
for user in users: for user in users:
print(".", end="") print(".", end="")
lists_stream.populate_lists_stream_task.delay(user.id) lists_stream.populate_lists_task.delay(user.id)
class Command(BaseCommand): class Command(BaseCommand):

View File

@ -14,7 +14,7 @@ def populate_streams(stream=None):
print("This may take a long time! Please be patient.") print("This may take a long time! Please be patient.")
for user in users: for user in users:
print(".", end="") print(".", end="")
lists_stream.populate_lists_stream_task.delay(user.id) lists_stream.populate_lists_task.delay(user.id)
for stream_key in streams: for stream_key in streams:
print(".", end="") print(".", end="")
activitystreams.populate_stream_task.delay(stream_key, user.id) activitystreams.populate_stream_task.delay(stream_key, user.id)

View File

@ -7,6 +7,8 @@ from bookwyrm.management.commands.populate_lists_streams import populate_lists_s
@patch("bookwyrm.models.activitypub_mixin.broadcast_task.apply_async") @patch("bookwyrm.models.activitypub_mixin.broadcast_task.apply_async")
@patch("bookwyrm.activitystreams.add_status_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
class Activitystreams(TestCase): class Activitystreams(TestCase):
"""using redis to build activity streams""" """using redis to build activity streams"""
@ -45,10 +47,10 @@ class Activitystreams(TestCase):
) )
self.book = models.Edition.objects.create(title="test book") self.book = models.Edition.objects.create(title="test book")
def test_populate_streams(self, _): def test_populate_streams(self, *_):
"""make sure the function on the redis manager gets called""" """make sure the function on the redis manager gets called"""
with patch( with patch(
"bookwyrm.lists_stream.populate_lists_stream_task.delay" "bookwyrm.lists_stream.populate_lists_task.delay"
) as list_mock: ) as list_mock:
populate_lists_streams() populate_lists_streams()
self.assertEqual(list_mock.call_count, 2) # 2 users self.assertEqual(list_mock.call_count, 2) # 2 users

View File

@ -55,7 +55,7 @@ class Activitystreams(TestCase):
with patch( with patch(
"bookwyrm.activitystreams.populate_stream_task.delay" "bookwyrm.activitystreams.populate_stream_task.delay"
) as redis_mock, patch( ) as redis_mock, patch(
"bookwyrm.lists_stream.populate_lists_stream_task.delay" "bookwyrm.lists_stream.populate_lists_task.delay"
) as list_mock: ) as list_mock:
populate_streams() populate_streams()
self.assertEqual(redis_mock.call_count, 6) # 2 users x 3 streams self.assertEqual(redis_mock.call_count, 6) # 2 users x 3 streams