Mocks redis in feed view tests

This commit is contained in:
Mouse Reeve 2021-03-23 09:09:30 -07:00
parent b9ec6a1e2b
commit 2d350474bf

View file

@ -14,6 +14,8 @@ from bookwyrm import views
from bookwyrm.activitypub import ActivitypubResponse from bookwyrm.activitypub import ActivitypubResponse
@patch("bookwyrm.activitystreams.ActivityStream.get_activity_stream")
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
class FeedViews(TestCase): class FeedViews(TestCase):
""" activity feed, statuses, dms """ """ activity feed, statuses, dms """
@ -34,7 +36,7 @@ class FeedViews(TestCase):
) )
models.SiteSettings.objects.create() models.SiteSettings.objects.create()
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()
request = self.factory.get("") request = self.factory.get("")
@ -44,7 +46,7 @@ class FeedViews(TestCase):
result.render() result.render()
self.assertEqual(result.status_code, 200) self.assertEqual(result.status_code, 200)
def test_status_page(self): def test_status_page(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.Status.as_view() view = views.Status.as_view()
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"): with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
@ -64,7 +66,7 @@ class FeedViews(TestCase):
self.assertIsInstance(result, ActivitypubResponse) self.assertIsInstance(result, ActivitypubResponse)
self.assertEqual(result.status_code, 200) self.assertEqual(result.status_code, 200)
def test_status_page_with_image(self): def test_status_page_with_image(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.Status.as_view() view = views.Status.as_view()
@ -100,7 +102,7 @@ class FeedViews(TestCase):
self.assertIsInstance(result, ActivitypubResponse) self.assertIsInstance(result, ActivitypubResponse)
self.assertEqual(result.status_code, 200) self.assertEqual(result.status_code, 200)
def test_replies_page(self): def test_replies_page(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.Replies.as_view() view = views.Replies.as_view()
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"): with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
@ -120,7 +122,7 @@ class FeedViews(TestCase):
self.assertIsInstance(result, ActivitypubResponse) self.assertIsInstance(result, ActivitypubResponse)
self.assertEqual(result.status_code, 200) self.assertEqual(result.status_code, 200)
def test_direct_messages_page(self): def test_direct_messages_page(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.DirectMessage.as_view() view = views.DirectMessage.as_view()
request = self.factory.get("") request = self.factory.get("")
@ -130,7 +132,7 @@ class FeedViews(TestCase):
result.render() result.render()
self.assertEqual(result.status_code, 200) self.assertEqual(result.status_code, 200)
def test_get_suggested_book(self): def test_get_suggested_book(self, *_):
""" gets books the ~*~ algorithm ~*~ thinks you want to post about """ """ gets books the ~*~ algorithm ~*~ thinks you want to post about """
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"): with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
models.ShelfBook.objects.create( models.ShelfBook.objects.create(