mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-27 03:51:08 +00:00
More mocks
This commit is contained in:
parent
bb94995389
commit
72d5238590
20 changed files with 21 additions and 0 deletions
|
@ -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"""
|
||||
|
||||
|
|
|
@ -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"""
|
||||
|
||||
|
|
|
@ -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"""
|
||||
|
||||
|
|
|
@ -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"""
|
||||
|
||||
|
|
|
@ -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"""
|
||||
|
||||
|
|
|
@ -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"""
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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"""
|
||||
|
||||
|
|
|
@ -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"""
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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"""
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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"""
|
||||
|
|
|
@ -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"""
|
||||
|
||||
|
|
|
@ -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"""
|
||||
|
|
|
@ -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"""
|
||||
|
|
|
@ -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"""
|
||||
|
||||
|
|
|
@ -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"""
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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"""
|
||||
|
|
Loading…
Reference in a new issue