mocks mocks more mocks
This commit is contained in:
@ -6,6 +6,7 @@ from django.test import TestCase
|
||||
from bookwyrm import models
|
||||
|
||||
|
||||
@patch("bookwyrm.activitystreams.add_user_statuses_task.delay")
|
||||
class Relationship(TestCase):
|
||||
"""following, blocking, stuff like that"""
|
||||
|
||||
@ -30,7 +31,7 @@ class Relationship(TestCase):
|
||||
self.local_user.remote_id = "http://local.com/user/mouse"
|
||||
self.local_user.save(broadcast=False, update_fields=["remote_id"])
|
||||
|
||||
def test_user_follows_from_request(self):
|
||||
def test_user_follows_from_request(self, _):
|
||||
"""convert a follow request into a follow"""
|
||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay") as mock:
|
||||
request = models.UserFollowRequest.objects.create(
|
||||
@ -51,7 +52,7 @@ class Relationship(TestCase):
|
||||
self.assertEqual(rel.user_subject, self.local_user)
|
||||
self.assertEqual(rel.user_object, self.remote_user)
|
||||
|
||||
def test_user_follows_from_request_custom_remote_id(self):
|
||||
def test_user_follows_from_request_custom_remote_id(self, _):
|
||||
"""store a specific remote id for a relationship provided by remote"""
|
||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
|
||||
request = models.UserFollowRequest.objects.create(
|
||||
@ -69,7 +70,7 @@ class Relationship(TestCase):
|
||||
self.assertEqual(rel.user_object, self.remote_user)
|
||||
|
||||
@patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay")
|
||||
def test_follow_request_activity(self, broadcast_mock):
|
||||
def test_follow_request_activity(self, broadcast_mock, _):
|
||||
"""accept a request and make it a relationship"""
|
||||
models.UserFollowRequest.objects.create(
|
||||
user_subject=self.local_user,
|
||||
@ -81,7 +82,7 @@ class Relationship(TestCase):
|
||||
self.assertEqual(activity["type"], "Follow")
|
||||
|
||||
@patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay")
|
||||
def test_follow_request_accept(self, broadcast_mock):
|
||||
def test_follow_request_accept(self, broadcast_mock, _):
|
||||
"""accept a request and make it a relationship"""
|
||||
self.local_user.manually_approves_followers = True
|
||||
self.local_user.save(
|
||||
@ -107,7 +108,7 @@ class Relationship(TestCase):
|
||||
self.assertEqual(rel.user_object, self.local_user)
|
||||
|
||||
@patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay")
|
||||
def test_follow_request_reject(self, broadcast_mock):
|
||||
def test_follow_request_reject(self, broadcast_mock, _):
|
||||
"""accept a request and make it a relationship"""
|
||||
self.local_user.manually_approves_followers = True
|
||||
self.local_user.save(
|
||||
|
@ -9,6 +9,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")
|
||||
@patch("bookwyrm.activitystreams.add_book_statuses_task.delay")
|
||||
class Shelf(TestCase):
|
||||
"""some activitypub oddness ahead"""
|
||||
|
||||
|
@ -16,7 +16,7 @@ from bookwyrm import activitypub, models, settings
|
||||
# pylint: disable=too-many-public-methods
|
||||
@patch("bookwyrm.models.Status.broadcast")
|
||||
@patch("bookwyrm.activitystreams.add_status_task.delay")
|
||||
@patch("bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores")
|
||||
@patch("bookwyrm.activitystreams.remove_status_task.delay")
|
||||
class Status(TestCase):
|
||||
"""lotta types of statuses"""
|
||||
|
||||
@ -120,15 +120,12 @@ class Status(TestCase):
|
||||
|
||||
def test_status_to_activity_tombstone(self, *_):
|
||||
"""subclass of the base model version with a "pure" serializer"""
|
||||
with patch(
|
||||
"bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores"
|
||||
):
|
||||
status = models.Status.objects.create(
|
||||
content="test content",
|
||||
user=self.local_user,
|
||||
deleted=True,
|
||||
deleted_date=timezone.now(),
|
||||
)
|
||||
status = models.Status.objects.create(
|
||||
content="test content",
|
||||
user=self.local_user,
|
||||
deleted=True,
|
||||
deleted_date=timezone.now(),
|
||||
)
|
||||
activity = status.to_activity()
|
||||
self.assertEqual(activity["id"], status.remote_id)
|
||||
self.assertEqual(activity["type"], "Tombstone")
|
||||
|
Reference in New Issue
Block a user