Updates mocks

This commit is contained in:
Mouse Reeve
2021-08-03 10:25:53 -07:00
parent 88967e589b
commit be044bce0d
45 changed files with 473 additions and 393 deletions

View File

@ -7,18 +7,20 @@ from bookwyrm import models, settings
# pylint: disable=unused-argument
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
class Shelf(TestCase):
"""some activitypub oddness ahead"""
def setUp(self):
"""look, a shelf"""
self.local_user = models.User.objects.create_user(
"mouse", "mouse@mouse.mouse", "mouseword", local=True, localname="mouse"
)
with patch("bookwyrm.suggested_users.rerank_suggestions_task.delay"):
self.local_user = models.User.objects.create_user(
"mouse", "mouse@mouse.mouse", "mouseword", local=True, localname="mouse"
)
work = models.Work.objects.create(title="Test Work")
self.book = models.Edition.objects.create(title="test book", parent_work=work)
def test_remote_id(self):
def test_remote_id(self, _):
"""shelves use custom remote ids"""
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
shelf = models.Shelf.objects.create(
@ -27,7 +29,7 @@ class Shelf(TestCase):
expected_id = "https://%s/user/mouse/books/test-shelf" % settings.DOMAIN
self.assertEqual(shelf.get_remote_id(), expected_id)
def test_to_activity(self):
def test_to_activity(self, _):
"""jsonify it"""
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
shelf = models.Shelf.objects.create(
@ -41,7 +43,7 @@ class Shelf(TestCase):
self.assertEqual(activity_json["name"], "Test Shelf")
self.assertEqual(activity_json["owner"], self.local_user.remote_id)
def test_create_update_shelf(self):
def test_create_update_shelf(self, _):
"""create and broadcast shelf creation"""
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay") as mock:
@ -62,7 +64,7 @@ class Shelf(TestCase):
self.assertEqual(activity["object"]["name"], "arthur russel")
self.assertEqual(shelf.name, "arthur russel")
def test_shelve(self):
def test_shelve(self, _):
"""create and broadcast shelf creation"""
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
shelf = models.Shelf.objects.create(