forked from mirrors/bookwyrm
Updates activistreams add_status mock
This commit is contained in:
parent
d7557926f7
commit
a6b0ba1826
25 changed files with 61 additions and 62 deletions
|
@ -19,7 +19,7 @@ from bookwyrm.activitypub import ActivitySerializerError
|
|||
from bookwyrm import models
|
||||
|
||||
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
@patch("bookwyrm.suggested_users.rerank_user_task.delay")
|
||||
@patch("bookwyrm.suggested_users.remove_user_task.delay")
|
||||
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
|
||||
|
|
|
@ -215,7 +215,7 @@ class GoodreadsImport(TestCase):
|
|||
self.assertEqual(readthrough.start_date, make_date(2020, 10, 21))
|
||||
self.assertEqual(readthrough.finish_date, make_date(2020, 10, 25))
|
||||
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
def test_handle_imported_book_review(self, *_):
|
||||
"""goodreads review import"""
|
||||
import_job = models.ImportJob.objects.create(user=self.user)
|
||||
|
@ -237,7 +237,7 @@ class GoodreadsImport(TestCase):
|
|||
self.assertEqual(review.published_date, make_date(2019, 7, 8))
|
||||
self.assertEqual(review.privacy, "unlisted")
|
||||
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
def test_handle_imported_book_rating(self, *_):
|
||||
"""goodreads rating import"""
|
||||
import_job = models.ImportJob.objects.create(user=self.user)
|
||||
|
|
|
@ -197,7 +197,7 @@ class LibrarythingImport(TestCase):
|
|||
self.assertEqual(readthrough.start_date, make_date(2007, 4, 16))
|
||||
self.assertEqual(readthrough.finish_date, make_date(2007, 5, 8))
|
||||
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
def test_handle_imported_book_review(self, *_):
|
||||
"""librarything review import"""
|
||||
import_job = models.ImportJob.objects.create(user=self.user)
|
||||
|
|
|
@ -37,7 +37,7 @@ class Activitystreams(TestCase):
|
|||
|
||||
def test_populate_streams(self, _):
|
||||
"""make sure the function on the redis manager gets called"""
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay"):
|
||||
models.Comment.objects.create(
|
||||
user=self.local_user, content="hi", book=self.book
|
||||
)
|
||||
|
|
|
@ -20,7 +20,7 @@ from bookwyrm.settings import PAGE_LENGTH
|
|||
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
@patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay")
|
||||
class ActivitypubMixins(TestCase):
|
||||
"""functionality shared across models"""
|
||||
|
|
|
@ -62,7 +62,7 @@ class BaseModel(TestCase):
|
|||
base_model.set_remote_id(None, instance, False)
|
||||
self.assertIsNone(instance.remote_id)
|
||||
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
def test_object_visible_to_user(self, _):
|
||||
"""does a user have permission to view an object"""
|
||||
obj = models.Status.objects.create(
|
||||
|
@ -91,7 +91,7 @@ class BaseModel(TestCase):
|
|||
obj.mention_users.add(self.local_user)
|
||||
self.assertTrue(obj.visible_to_user(self.local_user))
|
||||
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
def test_object_visible_to_user_follower(self, _):
|
||||
"""what you can see if you follow a user"""
|
||||
self.remote_user.followers.add(self.local_user)
|
||||
|
@ -111,7 +111,7 @@ class BaseModel(TestCase):
|
|||
obj.mention_users.add(self.local_user)
|
||||
self.assertTrue(obj.visible_to_user(self.local_user))
|
||||
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
def test_object_visible_to_user_blocked(self, _):
|
||||
"""you can't see it if they block you"""
|
||||
self.remote_user.blocks.add(self.local_user)
|
||||
|
|
|
@ -206,7 +206,7 @@ class ModelFields(TestCase):
|
|||
self.assertEqual(model_instance.privacy_field, "followers")
|
||||
|
||||
@patch("bookwyrm.models.activitypub_mixin.ObjectMixin.broadcast")
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
def test_privacy_field_set_activity_from_field(self, *_):
|
||||
"""translate between to/cc fields and privacy"""
|
||||
user = User.objects.create_user(
|
||||
|
|
|
@ -15,7 +15,7 @@ from bookwyrm import activitypub, models, settings
|
|||
|
||||
# pylint: disable=too-many-public-methods
|
||||
@patch("bookwyrm.models.Status.broadcast")
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores")
|
||||
class Status(TestCase):
|
||||
"""lotta types of statuses"""
|
||||
|
|
|
@ -5,7 +5,7 @@ from bookwyrm import activitystreams, models
|
|||
|
||||
|
||||
@patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay")
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
@patch("bookwyrm.activitystreams.BooksStream.add_book_statuses")
|
||||
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
|
||||
# pylint: disable=too-many-public-methods
|
||||
|
|
|
@ -10,7 +10,7 @@ from bookwyrm.suggested_users import suggested_users, get_annotated_users
|
|||
|
||||
|
||||
@patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay")
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
|
||||
@patch("bookwyrm.suggested_users.rerank_user_task.delay")
|
||||
@patch("bookwyrm.suggested_users.remove_user_task.delay")
|
||||
|
|
|
@ -15,7 +15,7 @@ from bookwyrm.templatetags import (
|
|||
)
|
||||
|
||||
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores")
|
||||
class TemplateTags(TestCase):
|
||||
"""lotta different things here"""
|
||||
|
|
|
@ -35,7 +35,7 @@ class InboxActivities(TestCase):
|
|||
)
|
||||
|
||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay"):
|
||||
self.status = models.Status.objects.create(
|
||||
user=self.local_user,
|
||||
content="Test status",
|
||||
|
@ -53,7 +53,7 @@ class InboxActivities(TestCase):
|
|||
|
||||
models.SiteSettings.objects.create()
|
||||
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores")
|
||||
def test_boost(self, redis_mock, _):
|
||||
"""boost a status"""
|
||||
|
@ -84,7 +84,7 @@ class InboxActivities(TestCase):
|
|||
self.assertEqual(notification.related_status, self.status)
|
||||
|
||||
@responses.activate
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores")
|
||||
def test_boost_remote_status(self, redis_mock, _):
|
||||
"""boost a status from a remote server"""
|
||||
|
@ -141,7 +141,7 @@ class InboxActivities(TestCase):
|
|||
content="hi",
|
||||
user=self.remote_user,
|
||||
)
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay"):
|
||||
status.save(broadcast=False)
|
||||
activity = {
|
||||
"type": "Announce",
|
||||
|
@ -158,7 +158,7 @@ class InboxActivities(TestCase):
|
|||
views.inbox.activity_task(activity)
|
||||
self.assertEqual(models.Boost.objects.count(), 0)
|
||||
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores")
|
||||
def test_unboost(self, *_):
|
||||
"""undo a boost"""
|
||||
|
|
|
@ -47,7 +47,7 @@ class InboxCreate(TestCase):
|
|||
}
|
||||
models.SiteSettings.objects.create()
|
||||
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
def test_create_status(self, *_):
|
||||
"""the "it justs works" mode"""
|
||||
datafile = pathlib.Path(__file__).parent.joinpath(
|
||||
|
@ -61,7 +61,7 @@ class InboxCreate(TestCase):
|
|||
activity = self.create_json
|
||||
activity["object"] = status_data
|
||||
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status") as redis_mock:
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay") as redis_mock:
|
||||
views.inbox.activity_task(activity)
|
||||
self.assertTrue(redis_mock.called)
|
||||
|
||||
|
@ -77,7 +77,7 @@ class InboxCreate(TestCase):
|
|||
views.inbox.activity_task(activity)
|
||||
self.assertEqual(models.Status.objects.count(), 1)
|
||||
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
def test_create_comment_with_reading_status(self, *_):
|
||||
"""the "it justs works" mode"""
|
||||
datafile = pathlib.Path(__file__).parent.joinpath("../../data/ap_comment.json")
|
||||
|
@ -90,7 +90,7 @@ class InboxCreate(TestCase):
|
|||
activity = self.create_json
|
||||
activity["object"] = status_data
|
||||
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status") as redis_mock:
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay") as redis_mock:
|
||||
views.inbox.activity_task(activity)
|
||||
self.assertTrue(redis_mock.called)
|
||||
|
||||
|
@ -115,7 +115,7 @@ class InboxCreate(TestCase):
|
|||
activity = self.create_json
|
||||
activity["object"] = status_data
|
||||
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status") as redis_mock:
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay") as redis_mock:
|
||||
views.inbox.activity_task(activity)
|
||||
self.assertTrue(redis_mock.called)
|
||||
status = models.Status.objects.last()
|
||||
|
@ -128,7 +128,7 @@ class InboxCreate(TestCase):
|
|||
|
||||
def test_create_status_remote_note_with_reply(self, _):
|
||||
"""should only create it under the right circumstances"""
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay"):
|
||||
parent_status = models.Status.objects.create(
|
||||
user=self.local_user,
|
||||
content="Test status",
|
||||
|
@ -145,7 +145,7 @@ class InboxCreate(TestCase):
|
|||
activity = self.create_json
|
||||
activity["object"] = status_data
|
||||
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status") as redis_mock:
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay") as redis_mock:
|
||||
views.inbox.activity_task(activity)
|
||||
self.assertTrue(redis_mock.called)
|
||||
status = models.Status.objects.last()
|
||||
|
@ -184,7 +184,7 @@ class InboxCreate(TestCase):
|
|||
"rating": 3,
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
}
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status") as redis_mock:
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay") as redis_mock:
|
||||
views.inbox.activity_task(activity)
|
||||
self.assertTrue(redis_mock.called)
|
||||
rating = models.ReviewRating.objects.first()
|
||||
|
|
|
@ -33,7 +33,7 @@ class InboxActivities(TestCase):
|
|||
inbox="https://example.com/users/rat/inbox",
|
||||
outbox="https://example.com/users/rat/outbox",
|
||||
)
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay"):
|
||||
self.status = models.Status.objects.create(
|
||||
user=self.remote_user,
|
||||
content="Test status",
|
||||
|
|
|
@ -34,7 +34,7 @@ class InboxActivities(TestCase):
|
|||
)
|
||||
|
||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay"):
|
||||
self.status = models.Status.objects.create(
|
||||
user=self.local_user,
|
||||
content="Test status",
|
||||
|
|
|
@ -74,7 +74,7 @@ class BookViews(TestCase):
|
|||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
@patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay")
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
def test_book_page_statuses(self, *_):
|
||||
"""there are so many views, this just makes sure it LOADS"""
|
||||
view = views.Book.as_view()
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
""" test for app action functionality """
|
||||
from unittest.mock import patch
|
||||
from django.contrib.auth.models import AnonymousUser
|
||||
from django.template.response import TemplateResponse
|
||||
from django.test import TestCase
|
||||
from django.test.client import RequestFactory
|
||||
|
||||
|
@ -41,7 +40,7 @@ class DiscoverViews(TestCase):
|
|||
result.render()
|
||||
|
||||
@patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay")
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
def test_discover_page(self, *_):
|
||||
"""there are so many views, this just makes sure it LOADS"""
|
||||
view = views.Discover.as_view()
|
||||
|
|
|
@ -15,7 +15,7 @@ from bookwyrm.activitypub import ActivitypubResponse
|
|||
|
||||
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.get_activity_stream")
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
|
||||
@patch("bookwyrm.suggested_users.remove_user_task.delay")
|
||||
class FeedViews(TestCase):
|
||||
|
|
|
@ -104,7 +104,7 @@ class GoalViews(TestCase):
|
|||
result = view(request, self.local_user.localname, self.year)
|
||||
self.assertEqual(result.status_code, 404)
|
||||
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
def test_create_goal(self, _):
|
||||
"""create a new goal"""
|
||||
view = views.Goal.as_view()
|
||||
|
|
|
@ -11,7 +11,7 @@ from bookwyrm import models, views
|
|||
from bookwyrm.settings import USER_AGENT
|
||||
|
||||
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
|
||||
@patch("bookwyrm.suggested_users.rerank_user_task.delay")
|
||||
class ViewsHelpers(TestCase):
|
||||
|
|
|
@ -8,7 +8,7 @@ from bookwyrm import models, views
|
|||
|
||||
|
||||
@patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay")
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores")
|
||||
@patch("bookwyrm.activitystreams.remove_object_from_related_stores")
|
||||
class InteractionViews(TestCase):
|
||||
"""viewing and creating statuses"""
|
||||
|
||||
|
@ -47,7 +47,7 @@ class InteractionViews(TestCase):
|
|||
view = views.Favorite.as_view()
|
||||
request = self.factory.post("")
|
||||
request.user = self.remote_user
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay"):
|
||||
status = models.Status.objects.create(user=self.local_user, content="hi")
|
||||
|
||||
view(request, status.id)
|
||||
|
@ -65,7 +65,7 @@ class InteractionViews(TestCase):
|
|||
view = views.Unfavorite.as_view()
|
||||
request = self.factory.post("")
|
||||
request.user = self.remote_user
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay"):
|
||||
status = models.Status.objects.create(user=self.local_user, content="hi")
|
||||
views.Favorite.as_view()(request, status.id)
|
||||
|
||||
|
@ -82,7 +82,7 @@ class InteractionViews(TestCase):
|
|||
view = views.Boost.as_view()
|
||||
request = self.factory.post("")
|
||||
request.user = self.remote_user
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay"):
|
||||
status = models.Status.objects.create(user=self.local_user, content="hi")
|
||||
|
||||
view(request, status.id)
|
||||
|
@ -104,7 +104,7 @@ class InteractionViews(TestCase):
|
|||
view = views.Boost.as_view()
|
||||
request = self.factory.post("")
|
||||
request.user = self.local_user
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay"):
|
||||
status = models.Status.objects.create(user=self.local_user, content="hi")
|
||||
|
||||
with patch(
|
||||
|
@ -128,7 +128,7 @@ class InteractionViews(TestCase):
|
|||
view = views.Boost.as_view()
|
||||
request = self.factory.post("")
|
||||
request.user = self.local_user
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay"):
|
||||
status = models.Status.objects.create(
|
||||
user=self.local_user, content="hi", privacy="unlisted"
|
||||
)
|
||||
|
@ -143,7 +143,7 @@ class InteractionViews(TestCase):
|
|||
view = views.Boost.as_view()
|
||||
request = self.factory.post("")
|
||||
request.user = self.local_user
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay"):
|
||||
status = models.Status.objects.create(
|
||||
user=self.local_user, content="hi", privacy="followers"
|
||||
)
|
||||
|
@ -156,14 +156,14 @@ class InteractionViews(TestCase):
|
|||
view = views.Boost.as_view()
|
||||
request = self.factory.post("")
|
||||
request.user = self.local_user
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay"):
|
||||
status = models.Status.objects.create(user=self.local_user, content="hi")
|
||||
|
||||
view(request, status.id)
|
||||
view(request, status.id)
|
||||
self.assertEqual(models.Boost.objects.count(), 1)
|
||||
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
def test_unboost(self, *_):
|
||||
"""undo a boost"""
|
||||
view = views.Unboost.as_view()
|
||||
|
|
|
@ -56,7 +56,7 @@ class OutboxView(TestCase):
|
|||
|
||||
def test_outbox_privacy(self, _):
|
||||
"""don't show dms et cetera in outbox"""
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay"):
|
||||
models.Status.objects.create(
|
||||
content="PRIVATE!!", user=self.local_user, privacy="direct"
|
||||
)
|
||||
|
@ -79,7 +79,7 @@ class OutboxView(TestCase):
|
|||
|
||||
def test_outbox_filter(self, _):
|
||||
"""if we only care about reviews, only get reviews"""
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay"):
|
||||
models.Review.objects.create(
|
||||
content="look at this",
|
||||
name="hi",
|
||||
|
@ -105,7 +105,7 @@ class OutboxView(TestCase):
|
|||
|
||||
def test_outbox_bookwyrm_request_true(self, _):
|
||||
"""should differentiate between bookwyrm and outside requests"""
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay"):
|
||||
models.Review.objects.create(
|
||||
name="hi",
|
||||
content="look at this",
|
||||
|
@ -123,7 +123,7 @@ class OutboxView(TestCase):
|
|||
|
||||
def test_outbox_bookwyrm_request_false(self, _):
|
||||
"""should differentiate between bookwyrm and outside requests"""
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay"):
|
||||
models.Review.objects.create(
|
||||
name="hi",
|
||||
content="look at this",
|
||||
|
|
|
@ -8,7 +8,7 @@ from django.utils import timezone
|
|||
from bookwyrm import models, views
|
||||
|
||||
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
|
||||
class ReadingViews(TestCase):
|
||||
"""viewing and creating statuses"""
|
||||
|
|
|
@ -8,7 +8,7 @@ from bookwyrm.views import rss_feed
|
|||
|
||||
@patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay")
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.get_activity_stream")
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
class RssFeedView(TestCase):
|
||||
"""rss feed behaves as expected"""
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ class StatusViews(TestCase):
|
|||
request = self.factory.post("", form.data)
|
||||
request.user = self.local_user
|
||||
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status") as redis_mock:
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay") as redis_mock:
|
||||
view(request, "comment")
|
||||
self.assertTrue(redis_mock.called)
|
||||
|
||||
|
@ -74,7 +74,7 @@ class StatusViews(TestCase):
|
|||
user = models.User.objects.create_user(
|
||||
"rat", "rat@rat.com", "password", local=True
|
||||
)
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay"):
|
||||
parent = models.Status.objects.create(
|
||||
content="parent status", user=self.local_user
|
||||
)
|
||||
|
@ -89,7 +89,7 @@ class StatusViews(TestCase):
|
|||
request = self.factory.post("", form.data)
|
||||
request.user = user
|
||||
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status") as redis_mock:
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay") as redis_mock:
|
||||
view(request, "reply")
|
||||
self.assertTrue(redis_mock.called)
|
||||
|
||||
|
@ -119,7 +119,7 @@ class StatusViews(TestCase):
|
|||
request = self.factory.post("", form.data)
|
||||
request.user = self.local_user
|
||||
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status") as redis_mock:
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay") as redis_mock:
|
||||
view(request, "comment")
|
||||
self.assertTrue(redis_mock.called)
|
||||
|
||||
|
@ -147,7 +147,7 @@ class StatusViews(TestCase):
|
|||
request = self.factory.post("", form.data)
|
||||
request.user = self.local_user
|
||||
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status") as redis_mock:
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay") as redis_mock:
|
||||
view(request, "comment")
|
||||
self.assertTrue(redis_mock.called)
|
||||
status = models.Status.objects.get()
|
||||
|
@ -163,7 +163,7 @@ class StatusViews(TestCase):
|
|||
request = self.factory.post("", form.data)
|
||||
request.user = user
|
||||
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status") as redis_mock:
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay") as redis_mock:
|
||||
view(request, "reply")
|
||||
self.assertTrue(redis_mock.called)
|
||||
|
||||
|
@ -179,7 +179,7 @@ class StatusViews(TestCase):
|
|||
view = views.DeleteAndRedraft.as_view()
|
||||
request = self.factory.post("")
|
||||
request.user = self.local_user
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay"):
|
||||
status = models.Comment.objects.create(
|
||||
content="hi", book=self.book, user=self.local_user
|
||||
)
|
||||
|
@ -200,7 +200,7 @@ class StatusViews(TestCase):
|
|||
view = views.DeleteAndRedraft.as_view()
|
||||
request = self.factory.post("")
|
||||
request.user = self.local_user
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay"):
|
||||
status = models.ReviewRating.objects.create(
|
||||
book=self.book, rating=2.0, user=self.local_user
|
||||
)
|
||||
|
@ -220,7 +220,7 @@ class StatusViews(TestCase):
|
|||
view = views.DeleteAndRedraft.as_view()
|
||||
request = self.factory.post("")
|
||||
request.user = self.local_user
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay"):
|
||||
status = models.GeneratedNote.objects.create(
|
||||
content="hi", user=self.local_user
|
||||
)
|
||||
|
@ -344,7 +344,7 @@ class StatusViews(TestCase):
|
|||
def test_handle_delete_status(self, mock, *_):
|
||||
"""marks a status as deleted"""
|
||||
view = views.DeleteStatus.as_view()
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay"):
|
||||
status = models.Status.objects.create(user=self.local_user, content="hi")
|
||||
self.assertFalse(status.deleted)
|
||||
request = self.factory.post("")
|
||||
|
@ -364,7 +364,7 @@ class StatusViews(TestCase):
|
|||
def test_handle_delete_status_permission_denied(self, *_):
|
||||
"""marks a status as deleted"""
|
||||
view = views.DeleteStatus.as_view()
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay"):
|
||||
status = models.Status.objects.create(user=self.local_user, content="hi")
|
||||
self.assertFalse(status.deleted)
|
||||
request = self.factory.post("")
|
||||
|
@ -378,7 +378,7 @@ class StatusViews(TestCase):
|
|||
def test_handle_delete_status_moderator(self, mock, _):
|
||||
"""marks a status as deleted"""
|
||||
view = views.DeleteStatus.as_view()
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay"):
|
||||
status = models.Status.objects.create(user=self.local_user, content="hi")
|
||||
self.assertFalse(status.deleted)
|
||||
request = self.factory.post("")
|
||||
|
|
Loading…
Reference in a new issue