This commit is contained in:
Joachim 2021-05-27 23:21:47 +02:00
parent f8df501239
commit 878cc5cb17
6 changed files with 17 additions and 6 deletions

View file

@ -113,7 +113,9 @@ class AbstractConnector(TestCase):
)
with patch("bookwyrm.preview_images.generate_edition_preview_image_task.delay"):
with patch("bookwyrm.connectors.abstract_connector.load_more_data.delay"):
result = self.connector.get_or_create_book("https://example.com/book/abcd")
result = self.connector.get_or_create_book(
"https://example.com/book/abcd"
)
self.assertEqual(result, self.book)
self.assertEqual(models.Edition.objects.count(), 1)
self.assertEqual(models.Edition.objects.count(), 1)

View file

@ -235,7 +235,9 @@ class Openlibrary(TestCase):
"bookwyrm.connectors.openlibrary.Connector." "get_authors_from_data"
) as mock:
mock.return_value = []
result = self.connector.create_edition_from_data(work, self.edition_data)
result = self.connector.create_edition_from_data(
work, self.edition_data
)
self.assertEqual(result.parent_work, work)
self.assertEqual(result.title, "Sabriel")
self.assertEqual(result.isbn_10, "0060273224")

View file

@ -256,7 +256,10 @@ class ActivitypubFields(TestCase):
# test receiving an unknown remote id and loading data
responses.add(
responses.GET, "https://example.com/user/mouse", json=userdata, status=200
responses.GET,
"https://example.com/user/mouse",
json=userdata,
status=200,
)
with patch("bookwyrm.models.user.set_remote_server.delay"):
value = instance.field_from_activity("https://example.com/user/mouse")

View file

@ -175,7 +175,9 @@ class ImportJob(TestCase):
with patch(
"bookwyrm.connectors.openlibrary.Connector." "get_authors_from_data"
):
with patch("bookwyrm.preview_images.generate_edition_preview_image_task.delay"):
with patch(
"bookwyrm.preview_images.generate_edition_preview_image_task.delay"
):
book = self.item_1.get_book_from_isbn()
self.assertEqual(book.title, "Sabriel")

View file

@ -163,7 +163,9 @@ class InboxCreate(TestCase):
"@context": "https://www.w3.org/ns/activitystreams",
}
with patch("bookwyrm.preview_images.generate_edition_preview_image_task.delay"):
with patch("bookwyrm.activitystreams.ActivityStream.add_status") as redis_mock:
with patch(
"bookwyrm.activitystreams.ActivityStream.add_status"
) as redis_mock:
views.inbox.activity_task(activity)
self.assertTrue(redis_mock.called)
rating = models.ReviewRating.objects.first()