Changes remove status redis mock

This commit is contained in:
Mouse Reeve 2021-04-05 14:08:24 -07:00
parent 04b9704187
commit 56330d448b
5 changed files with 21 additions and 11 deletions

View file

@ -116,7 +116,9 @@ class Status(TestCase):
def test_status_to_activity_tombstone(self, *_):
""" subclass of the base model version with a "pure" serializer """
with patch("bookwyrm.activitystreams.ActivityStream.remove_status"):
with patch(
"bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores"
):
status = models.Status.objects.create(
content="test content",
user=self.local_user,

View file

@ -85,7 +85,9 @@ class TemplateTags(TestCase):
second_child = models.Status.objects.create(
reply_parent=parent, user=self.user, content="hi"
)
with patch("bookwyrm.activitystreams.ActivityStream.remove_status"):
with patch(
"bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores"
):
third_child = models.Status.objects.create(
reply_parent=parent,
user=self.user,

View file

@ -444,7 +444,7 @@ class Inbox(TestCase):
"object": {"id": self.status.remote_id, "type": "Tombstone"},
}
with patch(
"bookwyrm.activitystreams.ActivityStream.remove_status"
"bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores"
) as redis_mock:
views.inbox.activity_task(activity)
self.assertTrue(redis_mock.called)
@ -477,7 +477,7 @@ class Inbox(TestCase):
"object": {"id": self.status.remote_id, "type": "Tombstone"},
}
with patch(
"bookwyrm.activitystreams.ActivityStream.remove_status"
"bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores"
) as redis_mock:
views.inbox.activity_task(activity)
self.assertTrue(redis_mock.called)
@ -616,7 +616,7 @@ class Inbox(TestCase):
},
}
with patch(
"bookwyrm.activitystreams.ActivityStream.remove_status"
"bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores"
) as redis_mock:
views.inbox.activity_task(activity)
self.assertTrue(redis_mock.called)

View file

@ -164,7 +164,7 @@ class InteractionViews(TestCase):
self.assertEqual(models.Boost.objects.count(), 1)
self.assertEqual(models.Notification.objects.count(), 1)
with patch(
"bookwyrm.activitystreams.ActivityStream.remove_status"
"bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores"
) as redis_mock:
view(request, status.id)
self.assertTrue(redis_mock.called)

View file

@ -177,7 +177,9 @@ class StatusViews(TestCase):
content="hi", book=self.book, user=self.local_user
)
with patch("bookwyrm.activitystreams.ActivityStream.remove_status") as mock:
with patch(
"bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores"
) as mock:
result = view(request, status.id)
self.assertTrue(mock.called)
result.render()
@ -196,7 +198,9 @@ class StatusViews(TestCase):
book=self.book, rating=2.0, user=self.local_user
)
with patch("bookwyrm.activitystreams.ActivityStream.remove_status") as mock:
with patch(
"bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores"
) as mock:
result = view(request, status.id)
self.assertFalse(mock.called)
self.assertEqual(result.status_code, 400)
@ -214,7 +218,9 @@ class StatusViews(TestCase):
content="hi", user=self.local_user
)
with patch("bookwyrm.activitystreams.ActivityStream.remove_status") as mock:
with patch(
"bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores"
) as mock:
result = view(request, status.id)
self.assertFalse(mock.called)
self.assertEqual(result.status_code, 400)
@ -316,7 +322,7 @@ class StatusViews(TestCase):
request.user = self.local_user
with patch(
"bookwyrm.activitystreams.ActivityStream.remove_status"
"bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores"
) as redis_mock:
view(request, status.id)
self.assertTrue(redis_mock.called)
@ -351,7 +357,7 @@ class StatusViews(TestCase):
request.user.is_superuser = True
with patch(
"bookwyrm.activitystreams.ActivityStream.remove_status"
"bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores"
) as redis_mock:
view(request, status.id)
self.assertTrue(redis_mock.called)