forked from mirrors/bookwyrm
Changes remove status redis mock
This commit is contained in:
parent
04b9704187
commit
56330d448b
5 changed files with 21 additions and 11 deletions
|
@ -116,7 +116,9 @@ class Status(TestCase):
|
||||||
|
|
||||||
def test_status_to_activity_tombstone(self, *_):
|
def test_status_to_activity_tombstone(self, *_):
|
||||||
""" subclass of the base model version with a "pure" serializer """
|
""" 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(
|
status = models.Status.objects.create(
|
||||||
content="test content",
|
content="test content",
|
||||||
user=self.local_user,
|
user=self.local_user,
|
||||||
|
|
|
@ -85,7 +85,9 @@ class TemplateTags(TestCase):
|
||||||
second_child = models.Status.objects.create(
|
second_child = models.Status.objects.create(
|
||||||
reply_parent=parent, user=self.user, content="hi"
|
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(
|
third_child = models.Status.objects.create(
|
||||||
reply_parent=parent,
|
reply_parent=parent,
|
||||||
user=self.user,
|
user=self.user,
|
||||||
|
|
|
@ -444,7 +444,7 @@ class Inbox(TestCase):
|
||||||
"object": {"id": self.status.remote_id, "type": "Tombstone"},
|
"object": {"id": self.status.remote_id, "type": "Tombstone"},
|
||||||
}
|
}
|
||||||
with patch(
|
with patch(
|
||||||
"bookwyrm.activitystreams.ActivityStream.remove_status"
|
"bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores"
|
||||||
) as redis_mock:
|
) as redis_mock:
|
||||||
views.inbox.activity_task(activity)
|
views.inbox.activity_task(activity)
|
||||||
self.assertTrue(redis_mock.called)
|
self.assertTrue(redis_mock.called)
|
||||||
|
@ -477,7 +477,7 @@ class Inbox(TestCase):
|
||||||
"object": {"id": self.status.remote_id, "type": "Tombstone"},
|
"object": {"id": self.status.remote_id, "type": "Tombstone"},
|
||||||
}
|
}
|
||||||
with patch(
|
with patch(
|
||||||
"bookwyrm.activitystreams.ActivityStream.remove_status"
|
"bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores"
|
||||||
) as redis_mock:
|
) as redis_mock:
|
||||||
views.inbox.activity_task(activity)
|
views.inbox.activity_task(activity)
|
||||||
self.assertTrue(redis_mock.called)
|
self.assertTrue(redis_mock.called)
|
||||||
|
@ -616,7 +616,7 @@ class Inbox(TestCase):
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
with patch(
|
with patch(
|
||||||
"bookwyrm.activitystreams.ActivityStream.remove_status"
|
"bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores"
|
||||||
) as redis_mock:
|
) as redis_mock:
|
||||||
views.inbox.activity_task(activity)
|
views.inbox.activity_task(activity)
|
||||||
self.assertTrue(redis_mock.called)
|
self.assertTrue(redis_mock.called)
|
||||||
|
|
|
@ -164,7 +164,7 @@ class InteractionViews(TestCase):
|
||||||
self.assertEqual(models.Boost.objects.count(), 1)
|
self.assertEqual(models.Boost.objects.count(), 1)
|
||||||
self.assertEqual(models.Notification.objects.count(), 1)
|
self.assertEqual(models.Notification.objects.count(), 1)
|
||||||
with patch(
|
with patch(
|
||||||
"bookwyrm.activitystreams.ActivityStream.remove_status"
|
"bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores"
|
||||||
) as redis_mock:
|
) as redis_mock:
|
||||||
view(request, status.id)
|
view(request, status.id)
|
||||||
self.assertTrue(redis_mock.called)
|
self.assertTrue(redis_mock.called)
|
||||||
|
|
|
@ -177,7 +177,9 @@ class StatusViews(TestCase):
|
||||||
content="hi", book=self.book, user=self.local_user
|
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)
|
result = view(request, status.id)
|
||||||
self.assertTrue(mock.called)
|
self.assertTrue(mock.called)
|
||||||
result.render()
|
result.render()
|
||||||
|
@ -196,7 +198,9 @@ class StatusViews(TestCase):
|
||||||
book=self.book, rating=2.0, user=self.local_user
|
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)
|
result = view(request, status.id)
|
||||||
self.assertFalse(mock.called)
|
self.assertFalse(mock.called)
|
||||||
self.assertEqual(result.status_code, 400)
|
self.assertEqual(result.status_code, 400)
|
||||||
|
@ -214,7 +218,9 @@ class StatusViews(TestCase):
|
||||||
content="hi", user=self.local_user
|
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)
|
result = view(request, status.id)
|
||||||
self.assertFalse(mock.called)
|
self.assertFalse(mock.called)
|
||||||
self.assertEqual(result.status_code, 400)
|
self.assertEqual(result.status_code, 400)
|
||||||
|
@ -316,7 +322,7 @@ class StatusViews(TestCase):
|
||||||
request.user = self.local_user
|
request.user = self.local_user
|
||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
"bookwyrm.activitystreams.ActivityStream.remove_status"
|
"bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores"
|
||||||
) as redis_mock:
|
) as redis_mock:
|
||||||
view(request, status.id)
|
view(request, status.id)
|
||||||
self.assertTrue(redis_mock.called)
|
self.assertTrue(redis_mock.called)
|
||||||
|
@ -351,7 +357,7 @@ class StatusViews(TestCase):
|
||||||
request.user.is_superuser = True
|
request.user.is_superuser = True
|
||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
"bookwyrm.activitystreams.ActivityStream.remove_status"
|
"bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores"
|
||||||
) as redis_mock:
|
) as redis_mock:
|
||||||
view(request, status.id)
|
view(request, status.id)
|
||||||
self.assertTrue(redis_mock.called)
|
self.assertTrue(redis_mock.called)
|
||||||
|
|
Loading…
Reference in a new issue