forked from mirrors/bookwyrm
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.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"""
|
||||||
|
|
||||||
|
|
|
@ -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"""
|
||||||
|
|
||||||
|
|
|
@ -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"""
|
||||||
|
|
||||||
|
|
|
@ -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"""
|
||||||
|
|
||||||
|
|
|
@ -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"""
|
||||||
|
|
||||||
|
|
|
@ -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"""
|
||||||
|
|
|
@ -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):
|
||||||
|
|
|
@ -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"""
|
||||||
|
|
||||||
|
|
|
@ -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"""
|
||||||
|
|
|
@ -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")
|
||||||
|
|
|
@ -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"""
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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"""
|
||||||
|
|
|
@ -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"""
|
||||||
|
|
||||||
|
|
|
@ -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"""
|
||||||
|
|
|
@ -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"""
|
||||||
|
|
|
@ -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"""
|
||||||
|
|
||||||
|
|
|
@ -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"""
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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"""
|
||||||
|
|
Loading…
Reference in a new issue