mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-27 02:20:31 +00:00
Adds openlibrary keys to data
This commit is contained in:
parent
bb69c32a6c
commit
4f1d4d9bc0
2 changed files with 14 additions and 0 deletions
|
@ -6,3 +6,8 @@ class OpenLibraryImporter(Importer):
|
|||
"""csv downloads from OpenLibrary"""
|
||||
|
||||
service = "OpenLibrary"
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.row_mappings_guesses.append(("openlibrary_key", ["edition id"]))
|
||||
self.row_mappings_guesses.append(("openlibrary_work_key", ["work id"]))
|
||||
super().__init__(*args, **kwargs)
|
||||
|
|
|
@ -56,6 +56,15 @@ class OpenLibraryImport(TestCase):
|
|||
self.assertEqual(import_items[1].data["Edition Id"], "OL7798182M")
|
||||
|
||||
self.assertEqual(import_items[0].normalized_data["shelf"], "reading")
|
||||
self.assertIsNone(import_items[0].normalized_data["openlibrary_key"])
|
||||
self.assertEqual(
|
||||
import_items[0].normalized_data["openlibrary_work_key"],
|
||||
"OL102749W"
|
||||
)
|
||||
self.assertEqual(
|
||||
import_items[1].normalized_data["openlibrary_key"],
|
||||
"OL7798182M"
|
||||
)
|
||||
self.assertEqual(import_items[2].normalized_data["shelf"], "to-read")
|
||||
self.assertEqual(import_items[3].normalized_data["shelf"], "read")
|
||||
|
||||
|
|
Loading…
Reference in a new issue