From 1608ca640165a9786d224807ce321a070402c603 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Sat, 27 Jul 2024 13:16:34 +1000 Subject: [PATCH] improve formatting --- bookwyrm/importers/bookwyrm_import.py | 3 +- .../tests/importers/test_bookwyrm_import.py | 40 ++++++++++--------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/bookwyrm/importers/bookwyrm_import.py b/bookwyrm/importers/bookwyrm_import.py index d6b43f1ce..fb46966bf 100644 --- a/bookwyrm/importers/bookwyrm_import.py +++ b/bookwyrm/importers/bookwyrm_import.py @@ -1,5 +1,4 @@ """Import data from Bookwyrm export files""" -from typing import Any from django.http import QueryDict from bookwyrm.models import User @@ -36,4 +35,4 @@ class BookwyrmBooksImporter(Importer): service = "BookWyrm" row_mappings_guesses = Importer.row_mappings_guesses + [ ("shelf_name", ["shelf_name"]), - ] \ No newline at end of file + ] diff --git a/bookwyrm/tests/importers/test_bookwyrm_import.py b/bookwyrm/tests/importers/test_bookwyrm_import.py index 0d45b5fda..8e940c096 100644 --- a/bookwyrm/tests/importers/test_bookwyrm_import.py +++ b/bookwyrm/tests/importers/test_bookwyrm_import.py @@ -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"""