diff --git a/bookwyrm/connectors/bookwyrm_connector.py b/bookwyrm/connectors/bookwyrm_connector.py index f1e53971..78ae84c3 100644 --- a/bookwyrm/connectors/bookwyrm_connector.py +++ b/bookwyrm/connectors/bookwyrm_connector.py @@ -24,7 +24,7 @@ class Connector(AbstractConnector): def is_work_data(self, data): - return data['type'] == 'Work' + return data.get('type') == 'Work' def get_edition_from_work_data(self, data): diff --git a/bookwyrm/tests/connectors/test_abstract_connector.py b/bookwyrm/tests/connectors/test_abstract_connector.py index b207faf6..c01b00db 100644 --- a/bookwyrm/tests/connectors/test_abstract_connector.py +++ b/bookwyrm/tests/connectors/test_abstract_connector.py @@ -63,29 +63,6 @@ class AbstractConnector(TestCase): self.assertEqual(mapping.formatter('bb'), 'aabb') - def test_update_from_mappings(self): - data = { - 'title': 'Unused title', - 'isbn_10': '1234567890', - 'isbn_13': 'blahhh', - 'blah': 'bip', - 'format': 'hardcover', - 'series': ['one', 'two'], - } - mappings = [ - Mapping('isbn_10'), - Mapping('blah'),# not present on self.book - Mapping('physical_format', remote_field='format'), - Mapping('series', formatter=lambda x: x[0]), - ] - book = self.connector.update_from_mappings(self.book, data, mappings) - self.assertEqual(book.title, 'Example Edition') - self.assertEqual(book.isbn_10, '1234567890') - self.assertEqual(book.isbn_13, None) - self.assertEqual(book.physical_format, 'hardcover') - self.assertEqual(book.series, 'one') - - def test_match_from_mappings(self): edition = models.Edition.objects.create( title='Blah', diff --git a/bookwyrm/tests/data/fr_work.json b/bookwyrm/tests/data/fr_work.json index 4e759a19..3a36fc64 100644 --- a/bookwyrm/tests/data/fr_work.json +++ b/bookwyrm/tests/data/fr_work.json @@ -28,9 +28,7 @@ ], "lccn": null, "editions": [ - "https://bookwyrm.social/book/5989", - "OL28439584M", - "OL28300471M" + "https://bookwyrm.social/book/5989" ], "@context": "https://www.w3.org/ns/activitystreams" }