another round of mocks

This commit is contained in:
Mouse Reeve
2021-09-06 18:39:14 -07:00
parent 59400511c9
commit 2653458e56
11 changed files with 38 additions and 61 deletions

View File

@ -55,9 +55,8 @@ class InboxActivities(TestCase):
models.SiteSettings.objects.create()
@patch("bookwyrm.activitystreams.add_status_task.delay")
@patch("bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores")
def test_boost(self, redis_mock, _):
@patch("bookwyrm.activitystreams.handle_boost_task.delay")
def test_boost(self, _):
"""boost a status"""
self.assertEqual(models.Notification.objects.count(), 0)
activity = {
@ -73,9 +72,6 @@ class InboxActivities(TestCase):
discarder.return_value = False
views.inbox.activity_task(activity)
# boost added to redis activitystreams
self.assertTrue(redis_mock.called)
# boost created of correct status
boost = models.Boost.objects.get()
self.assertEqual(boost.boosted_status, self.status)
@ -86,9 +82,8 @@ class InboxActivities(TestCase):
self.assertEqual(notification.related_status, self.status)
@responses.activate
@patch("bookwyrm.activitystreams.add_status_task.delay")
@patch("bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores")
def test_boost_remote_status(self, redis_mock, _):
@patch("bookwyrm.activitystreams.handle_boost_task.delay")
def test_boost_remote_status(self, _):
"""boost a status from a remote server"""
work = models.Work.objects.create(title="work title")
book = models.Edition.objects.create(
@ -129,7 +124,6 @@ class InboxActivities(TestCase):
with patch("bookwyrm.models.status.Status.ignore_activity") as discarder:
discarder.return_value = False
views.inbox.activity_task(activity)
self.assertTrue(redis_mock.called)
boost = models.Boost.objects.get()
self.assertEqual(boost.boosted_status.remote_id, "https://remote.com/status/1")
@ -161,7 +155,8 @@ class InboxActivities(TestCase):
self.assertEqual(models.Boost.objects.count(), 0)
@patch("bookwyrm.activitystreams.add_status_task.delay")
@patch("bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores")
@patch("bookwyrm.activitystreams.handle_boost_task.delay")
@patch("bookwyrm.activitystreams.remove_status_task.delay")
def test_unboost(self, *_):
"""undo a boost"""
boost = models.Boost.objects.create(