improve formatting

This commit is contained in:
Hugh Rundle 2024-07-27 13:16:34 +10:00
parent 93c6b76dab
commit 1608ca6401
No known key found for this signature in database
GPG key ID: A7E35779918253F9
2 changed files with 22 additions and 21 deletions

View file

@ -1,5 +1,4 @@
"""Import data from Bookwyrm export files""" """Import data from Bookwyrm export files"""
from typing import Any
from django.http import QueryDict from django.http import QueryDict
from bookwyrm.models import User from bookwyrm.models import User
@ -36,4 +35,4 @@ class BookwyrmBooksImporter(Importer):
service = "BookWyrm" service = "BookWyrm"
row_mappings_guesses = Importer.row_mappings_guesses + [ row_mappings_guesses = Importer.row_mappings_guesses + [
("shelf_name", ["shelf_name"]), ("shelf_name", ["shelf_name"]),
] ]

View file

@ -66,27 +66,29 @@ class BookwyrmBooksImport(TestCase):
self.assertEqual(import_items[2].index, 2) self.assertEqual(import_items[2].index, 2)
self.assertEqual(import_items[2].shelf_name, "Cooking") self.assertEqual(import_items[2].shelf_name, "Cooking")
# def test_create_retry_job(self, *_): def test_create_retry_job(self, *_):
# """trying again with items that didn't import""" """trying again with items that didn't import"""
# import_job = self.importer.create_job( import_job = self.importer.create_job(
# self.local_user, self.csv, False, "unlisted" self.local_user, self.csv, False, "unlisted"
# ) )
# import_items = models.ImportItem.objects.filter(job=import_job).all()[:2] import_items = models.ImportItem.objects.filter(job=import_job).all()[:2]
# retry = self.importer.create_retry_job( retry = self.importer.create_retry_job(
# self.local_user, import_job, import_items self.local_user, import_job, import_items
# ) )
# self.assertNotEqual(import_job, retry) self.assertNotEqual(import_job, retry)
# self.assertEqual(retry.user, self.local_user) self.assertEqual(retry.user, self.local_user)
# self.assertEqual(retry.include_reviews, False) self.assertEqual(retry.include_reviews, False)
# self.assertEqual(retry.privacy, "unlisted") self.assertEqual(retry.privacy, "unlisted")
# retry_items = models.ImportItem.objects.filter(job=retry).all() retry_items = models.ImportItem.objects.filter(job=retry).all()
# self.assertEqual(len(retry_items), 2) self.assertEqual(len(retry_items), 2)
# self.assertEqual(retry_items[0].index, 0) self.assertEqual(retry_items[0].index, 0)
# self.assertEqual(retry_items[0].data["title"], "Gideon the Ninth (The Locked Tomb #1)") self.assertEqual(
# self.assertEqual(retry_items[1].index, 1) retry_items[0].data["title"], "Gideon the Ninth (The Locked Tomb #1)"
# self.assertEqual(retry_items[1].data["author_text"], "Aaron A. Reed") )
self.assertEqual(retry_items[1].index, 1)
self.assertEqual(retry_items[1].data["author_text"], "Aaron A. Reed")
def test_handle_imported_book(self, *_): def test_handle_imported_book(self, *_):
"""import added a book, this adds related connections""" """import added a book, this adds related connections"""