This commit is contained in:
Joachim
2021-05-26 23:57:29 +02:00
parent f848dcd756
commit 2ea1cd8319
69 changed files with 1370 additions and 1105 deletions

View File

@ -178,20 +178,26 @@ class Openlibrary(TestCase):
@responses.activate
def test_expand_book_data(self):
"""given a book, get more editions"""
work = models.Work.objects.create(title="Test Work", openlibrary_key="OL1234W")
edition = models.Edition.objects.create(title="Test Edition", parent_work=work)
with patch("bookwyrm.preview_images.generate_edition_preview_image_task.delay"):
work = models.Work.objects.create(
title="Test Work", openlibrary_key="OL1234W"
)
edition = models.Edition.objects.create(
title="Test Edition", parent_work=work
)
responses.add(
responses.GET,
"https://openlibrary.org/works/OL1234W/editions",
json={"entries": []},
)
with patch(
"bookwyrm.connectors.abstract_connector.AbstractConnector."
"create_edition_from_data"
):
self.connector.expand_book_data(edition)
self.connector.expand_book_data(work)
with patch("bookwyrm.preview_images.generate_user_preview_image_task.delay"):
with patch(
"bookwyrm.connectors.abstract_connector.AbstractConnector."
"create_edition_from_data"
):
self.connector.expand_book_data(edition)
self.connector.expand_book_data(work)
def test_get_description(self):
"""should do some cleanup on the description data"""