mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-06-07 08:18:50 +00:00
Removes outdated test of bookwyrm connector updater
This commit is contained in:
parent
4f6ce0307d
commit
9b79eb5fc3
3 changed files with 2 additions and 27 deletions
|
@ -24,7 +24,7 @@ class Connector(AbstractConnector):
|
||||||
|
|
||||||
|
|
||||||
def is_work_data(self, data):
|
def is_work_data(self, data):
|
||||||
return data['type'] == 'Work'
|
return data.get('type') == 'Work'
|
||||||
|
|
||||||
|
|
||||||
def get_edition_from_work_data(self, data):
|
def get_edition_from_work_data(self, data):
|
||||||
|
|
|
@ -63,29 +63,6 @@ class AbstractConnector(TestCase):
|
||||||
self.assertEqual(mapping.formatter('bb'), 'aabb')
|
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):
|
def test_match_from_mappings(self):
|
||||||
edition = models.Edition.objects.create(
|
edition = models.Edition.objects.create(
|
||||||
title='Blah',
|
title='Blah',
|
||||||
|
|
|
@ -28,9 +28,7 @@
|
||||||
],
|
],
|
||||||
"lccn": null,
|
"lccn": null,
|
||||||
"editions": [
|
"editions": [
|
||||||
"https://bookwyrm.social/book/5989",
|
"https://bookwyrm.social/book/5989"
|
||||||
"OL28439584M",
|
|
||||||
"OL28300471M"
|
|
||||||
],
|
],
|
||||||
"@context": "https://www.w3.org/ns/activitystreams"
|
"@context": "https://www.w3.org/ns/activitystreams"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue