Patches stray redis calls

This commit is contained in:
Mouse Reeve 2021-08-04 08:50:50 -07:00
parent cbf5747308
commit 89acfa4f3e
6 changed files with 12 additions and 6 deletions

View file

@ -405,7 +405,7 @@ def set_remote_server(user_id):
user = User.objects.get(id=user_id) user = User.objects.get(id=user_id)
actor_parts = urlparse(user.remote_id) actor_parts = urlparse(user.remote_id)
user.federated_server = get_or_create_remote_server(actor_parts.netloc) user.federated_server = get_or_create_remote_server(actor_parts.netloc)
user.save(broadcast=False) user.save(broadcast=False, update_fields=["federated_server"])
if user.bookwyrm_user and user.outbox: if user.bookwyrm_user and user.outbox:
get_remote_reviews.delay(user.outbox) get_remote_reviews.delay(user.outbox)

View file

@ -155,7 +155,8 @@ class User(TestCase):
self.assertIsNone(server.application_type) self.assertIsNone(server.application_type)
self.assertIsNone(server.application_version) self.assertIsNone(server.application_version)
def test_delete_user(self): @patch("bookwyrm.suggested_users.remove_user_task.delay")
def test_delete_user(self, _):
"""deactivate a user""" """deactivate a user"""
self.assertTrue(self.user.is_active) self.assertTrue(self.user.is_active)
with patch( with patch(

View file

@ -106,7 +106,8 @@ class InboxActivities(TestCase):
self.assertEqual(models.Notification.objects.count(), 1) self.assertEqual(models.Notification.objects.count(), 1)
self.assertEqual(models.Notification.objects.get(), notif) self.assertEqual(models.Notification.objects.get(), notif)
def test_delete_user(self): @patch("bookwyrm.suggested_users.remove_user_task.delay")
def test_delete_user(self, _):
"""delete a user""" """delete a user"""
self.assertTrue(models.User.objects.get(username="rat@example.com").is_active) self.assertTrue(models.User.objects.get(username="rat@example.com").is_active)
activity = { activity = {

View file

@ -80,7 +80,8 @@ class InboxUpdate(TestCase):
self.assertEqual(book_list.description, "summary text") self.assertEqual(book_list.description, "summary text")
self.assertEqual(book_list.remote_id, "https://example.com/list/22") self.assertEqual(book_list.remote_id, "https://example.com/list/22")
def test_update_user(self): @patch("bookwyrm.suggested_users.rerank_user_task.delay")
def test_update_user(self, _):
"""update an existing user""" """update an existing user"""
models.UserFollows.objects.create( models.UserFollows.objects.create(
user_subject=self.local_user, user_subject=self.local_user,

View file

@ -39,6 +39,7 @@ class FeedViews(TestCase):
) )
models.SiteSettings.objects.create() models.SiteSettings.objects.create()
@patch("bookwyrm.suggested_users.SuggestedUsers.get_suggestions")
def test_feed(self, *_): def test_feed(self, *_):
"""there are so many views, this just makes sure it LOADS""" """there are so many views, this just makes sure it LOADS"""
view = views.Feed.as_view() view = views.Feed.as_view()

View file

@ -106,7 +106,8 @@ class GetStartedViews(TestCase):
self.assertEqual(shelfbook.book, self.book) self.assertEqual(shelfbook.book, self.book)
self.assertEqual(shelfbook.user, self.local_user) self.assertEqual(shelfbook.user, self.local_user)
def test_users_view(self): @patch("bookwyrm.suggested_users.SuggestedUsers.get_suggestions")
def test_users_view(self, _):
"""there are so many views, this just makes sure it LOADS""" """there are so many views, this just makes sure it LOADS"""
view = views.GetStartedUsers.as_view() view = views.GetStartedUsers.as_view()
request = self.factory.get("") request = self.factory.get("")
@ -118,7 +119,8 @@ class GetStartedViews(TestCase):
result.render() result.render()
self.assertEqual(result.status_code, 200) self.assertEqual(result.status_code, 200)
def test_users_view_with_query(self): @patch("bookwyrm.suggested_users.SuggestedUsers.get_suggestions")
def test_users_view_with_query(self, _):
"""there are so many views, this just makes sure it LOADS""" """there are so many views, this just makes sure it LOADS"""
view = views.GetStartedUsers.as_view() view = views.GetStartedUsers.as_view()
request = self.factory.get("?query=rat") request = self.factory.get("?query=rat")