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"""
from typing import Any
from django.http import QueryDict
from bookwyrm.models import User

View file

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