More mocks

This commit is contained in:
Mouse Reeve 2021-09-06 14:50:33 -07:00
parent bb94995389
commit 72d5238590
20 changed files with 21 additions and 0 deletions

View file

@ -23,6 +23,7 @@ from bookwyrm import models
@patch("bookwyrm.suggested_users.rerank_user_task.delay") @patch("bookwyrm.suggested_users.rerank_user_task.delay")
@patch("bookwyrm.suggested_users.remove_user_task.delay") @patch("bookwyrm.suggested_users.remove_user_task.delay")
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") @patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
class BaseActivity(TestCase): class BaseActivity(TestCase):
"""the super class for model-linked activitypub dataclasses""" """the super class for model-linked activitypub dataclasses"""

View file

@ -22,6 +22,7 @@ def make_date(*args):
# pylint: disable=consider-using-with # pylint: disable=consider-using-with
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") @patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
class GoodreadsImport(TestCase): class GoodreadsImport(TestCase):
"""importing from goodreads csv""" """importing from goodreads csv"""

View file

@ -21,6 +21,7 @@ def make_date(*args):
# pylint: disable=consider-using-with # pylint: disable=consider-using-with
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") @patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
class LibrarythingImport(TestCase): class LibrarythingImport(TestCase):
"""importing from librarything tsv""" """importing from librarything tsv"""

View file

@ -25,6 +25,7 @@ from bookwyrm.models.activitypub_mixin import ActivitypubMixin
# pylint: disable=too-many-public-methods # pylint: disable=too-many-public-methods
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") @patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
class ModelFields(TestCase): class ModelFields(TestCase):
"""overwrites standard model feilds to work with activitypub""" """overwrites standard model feilds to work with activitypub"""

View file

@ -8,6 +8,7 @@ from bookwyrm import models, settings
# pylint: disable=unused-argument # pylint: disable=unused-argument
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") @patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
class Shelf(TestCase): class Shelf(TestCase):
"""some activitypub oddness ahead""" """some activitypub oddness ahead"""

View file

@ -8,6 +8,7 @@ from bookwyrm import activitystreams, models
@patch("bookwyrm.activitystreams.add_status_task.delay") @patch("bookwyrm.activitystreams.add_status_task.delay")
@patch("bookwyrm.activitystreams.BooksStream.add_book_statuses") @patch("bookwyrm.activitystreams.BooksStream.add_book_statuses")
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") @patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
# pylint: disable=too-many-public-methods # pylint: disable=too-many-public-methods
class Activitystreams(TestCase): class Activitystreams(TestCase):
"""using redis to build activity streams""" """using redis to build activity streams"""

View file

@ -12,6 +12,7 @@ from bookwyrm.suggested_users import suggested_users, get_annotated_users
@patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay") @patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay")
@patch("bookwyrm.activitystreams.add_status_task.delay") @patch("bookwyrm.activitystreams.add_status_task.delay")
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") @patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
@patch("bookwyrm.suggested_users.rerank_user_task.delay") @patch("bookwyrm.suggested_users.rerank_user_task.delay")
@patch("bookwyrm.suggested_users.remove_user_task.delay") @patch("bookwyrm.suggested_users.remove_user_task.delay")
class SuggestedUsers(TestCase): class SuggestedUsers(TestCase):

View file

@ -14,6 +14,7 @@ from bookwyrm.settings import DOMAIN
# pylint: disable=too-many-public-methods # pylint: disable=too-many-public-methods
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") @patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
class AuthenticationViews(TestCase): class AuthenticationViews(TestCase):
"""login and password management""" """login and password management"""

View file

@ -32,6 +32,7 @@ class DirectoryViews(TestCase):
self.anonymous_user.is_authenticated = False self.anonymous_user.is_authenticated = False
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") @patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
@patch("bookwyrm.suggested_users.rerank_user_task.delay") @patch("bookwyrm.suggested_users.rerank_user_task.delay")
def test_directory_page(self, *_): def test_directory_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 file

@ -103,6 +103,7 @@ class BookViews(TestCase):
self.assertEqual(result.status_code, 200) self.assertEqual(result.status_code, 200)
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") @patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
def test_switch_edition(self, _): def test_switch_edition(self, _):
"""updates user's relationships to a book""" """updates user's relationships to a book"""
work = models.Work.objects.create(title="test work") work = models.Work.objects.create(title="test work")

View file

@ -17,6 +17,7 @@ from bookwyrm.activitypub import ActivitypubResponse
@patch("bookwyrm.activitystreams.ActivityStream.get_activity_stream") @patch("bookwyrm.activitystreams.ActivityStream.get_activity_stream")
@patch("bookwyrm.activitystreams.add_status_task.delay") @patch("bookwyrm.activitystreams.add_status_task.delay")
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") @patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
@patch("bookwyrm.suggested_users.remove_user_task.delay") @patch("bookwyrm.suggested_users.remove_user_task.delay")
class FeedViews(TestCase): class FeedViews(TestCase):
"""activity feed, statuses, dms""" """activity feed, statuses, dms"""

View file

@ -46,6 +46,7 @@ class GetStartedViews(TestCase):
self.assertEqual(result.status_code, 200) self.assertEqual(result.status_code, 200)
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") @patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
@patch("bookwyrm.suggested_users.rerank_user_task.delay") @patch("bookwyrm.suggested_users.rerank_user_task.delay")
def test_profile_view_post(self, *_): def test_profile_view_post(self, *_):
"""save basic user details""" """save basic user details"""
@ -90,6 +91,7 @@ class GetStartedViews(TestCase):
self.assertEqual(result.status_code, 200) self.assertEqual(result.status_code, 200)
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") @patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
def test_books_view_post(self, _): def test_books_view_post(self, _):
"""shelve some books""" """shelve some books"""
view = views.GetStartedBooks.as_view() view = views.GetStartedBooks.as_view()

View file

@ -13,6 +13,7 @@ from bookwyrm.settings import USER_AGENT
@patch("bookwyrm.activitystreams.add_status_task.delay") @patch("bookwyrm.activitystreams.add_status_task.delay")
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") @patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
@patch("bookwyrm.suggested_users.rerank_user_task.delay") @patch("bookwyrm.suggested_users.rerank_user_task.delay")
class ViewsHelpers(TestCase): class ViewsHelpers(TestCase):
"""viewing and creating statuses""" """viewing and creating statuses"""

View file

@ -10,6 +10,7 @@ from bookwyrm import models, views
@patch("bookwyrm.activitystreams.add_status_task.delay") @patch("bookwyrm.activitystreams.add_status_task.delay")
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") @patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
class ReadingViews(TestCase): class ReadingViews(TestCase):
"""viewing and creating statuses""" """viewing and creating statuses"""

View file

@ -8,6 +8,7 @@ from bookwyrm import models
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") @patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
@patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay") @patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay")
class ReadThrough(TestCase): class ReadThrough(TestCase):
"""readthrough tests""" """readthrough tests"""

View file

@ -119,6 +119,7 @@ class ReportViews(TestCase):
self.assertFalse(report.resolved) self.assertFalse(report.resolved)
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") @patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
@patch("bookwyrm.suggested_users.remove_user_task.delay") @patch("bookwyrm.suggested_users.remove_user_task.delay")
def test_suspend_user(self, *_): def test_suspend_user(self, *_):
"""toggle whether a user is able to log in""" """toggle whether a user is able to log in"""

View file

@ -11,6 +11,7 @@ from bookwyrm.activitypub import ActivitypubResponse
@patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay") @patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay")
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") @patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
class ShelfViews(TestCase): class ShelfViews(TestCase):
"""tag views""" """tag views"""

View file

@ -10,6 +10,7 @@ from bookwyrm.settings import DOMAIN
# pylint: disable=invalid-name # pylint: disable=invalid-name
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") @patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
@patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay") @patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay")
class StatusViews(TestCase): class StatusViews(TestCase):
"""viewing and creating statuses""" """viewing and creating statuses"""

View file

@ -103,6 +103,7 @@ class UserViews(TestCase):
self.assertEqual(result.status_code, 200) self.assertEqual(result.status_code, 200)
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") @patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
def test_followers_page_blocked(self, _): def test_followers_page_blocked(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.Followers.as_view() view = views.Followers.as_view()

View file

@ -51,6 +51,7 @@ class UserAdminViews(TestCase):
self.assertEqual(result.status_code, 200) self.assertEqual(result.status_code, 200)
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") @patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
@patch("bookwyrm.suggested_users.remove_user_task.delay") @patch("bookwyrm.suggested_users.remove_user_task.delay")
def test_user_admin_page_post(self, *_): def test_user_admin_page_post(self, *_):
"""set the user's group""" """set the user's group"""