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.remove_user_task.delay")
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
class BaseActivity(TestCase):
"""the super class for model-linked activitypub dataclasses"""

View file

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

View file

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

View file

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

View file

@ -8,6 +8,7 @@ from bookwyrm import models, settings
# pylint: disable=unused-argument
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
class Shelf(TestCase):
"""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.BooksStream.add_book_statuses")
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
# pylint: disable=too-many-public-methods
class Activitystreams(TestCase):
"""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.activitystreams.add_status_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.remove_user_task.delay")
class SuggestedUsers(TestCase):

View file

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

View file

@ -32,6 +32,7 @@ class DirectoryViews(TestCase):
self.anonymous_user.is_authenticated = False
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
@patch("bookwyrm.suggested_users.rerank_user_task.delay")
def test_directory_page(self, *_):
"""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)
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
def test_switch_edition(self, _):
"""updates user's relationships to a book"""
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.add_status_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")
class FeedViews(TestCase):
"""activity feed, statuses, dms"""

View file

@ -46,6 +46,7 @@ class GetStartedViews(TestCase):
self.assertEqual(result.status_code, 200)
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
@patch("bookwyrm.suggested_users.rerank_user_task.delay")
def test_profile_view_post(self, *_):
"""save basic user details"""
@ -90,6 +91,7 @@ class GetStartedViews(TestCase):
self.assertEqual(result.status_code, 200)
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
def test_books_view_post(self, _):
"""shelve some books"""
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.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
@patch("bookwyrm.suggested_users.rerank_user_task.delay")
class ViewsHelpers(TestCase):
"""viewing and creating statuses"""

View file

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

View file

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

View file

@ -119,6 +119,7 @@ class ReportViews(TestCase):
self.assertFalse(report.resolved)
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
@patch("bookwyrm.suggested_users.remove_user_task.delay")
def test_suspend_user(self, *_):
"""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.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
class ShelfViews(TestCase):
"""tag views"""

View file

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

View file

@ -103,6 +103,7 @@ class UserViews(TestCase):
self.assertEqual(result.status_code, 200)
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
def test_followers_page_blocked(self, _):
"""there are so many views, this just makes sure it LOADS"""
view = views.Followers.as_view()

View file

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