diff --git a/bookwyrm/tests/connectors/test_openlibrary_connector.py b/bookwyrm/tests/connectors/test_openlibrary_connector.py index dc4c5f5b1..c277ba045 100644 --- a/bookwyrm/tests/connectors/test_openlibrary_connector.py +++ b/bookwyrm/tests/connectors/test_openlibrary_connector.py @@ -190,3 +190,19 @@ class Openlibrary(TestCase): ''' detect if the loaded json is an edition ''' edition = pick_default_edition(self.edition_list_data['entries']) self.assertEqual(edition['key'], '/books/OL9788823M') + + + def test_create_edition_from_data(self): + ''' okay but can it actually create an edition with proper metadata ''' + work = models.Work.objects.create(title='Hello') + 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') + self.assertIsNotNone(result.description) + self.assertEqual(result.languages[0], 'English') + self.assertEqual(result.publishers[0], 'Harper Trophy') + self.assertEqual(result.pages, 491) + self.assertEqual(result.subjects[0], 'Fantasy.') + self.assertEqual(result.physical_format, 'Hardcover') diff --git a/bookwyrm/tests/data/ol_edition.json b/bookwyrm/tests/data/ol_edition.json index 459e9dff4..2423364b1 100644 --- a/bookwyrm/tests/data/ol_edition.json +++ b/bookwyrm/tests/data/ol_edition.json @@ -9,6 +9,7 @@ "518848" ] }, + "physical_format": "Hardcover", "lc_classifications": [ "PZ7.N647 Sab 1995" ],