Uses workaround for test that fails ~sometimes~

This commit is contained in:
Mouse Reeve 2024-08-25 17:53:43 -07:00
parent 413c26bc5e
commit 9f5ca7ae60

View file

@ -65,25 +65,28 @@ class GenericImporter(TestCase):
import_items = models.ImportItem.objects.filter(job=import_job).all()
self.assertEqual(len(import_items), 4)
self.assertEqual(import_items[0].index, 0)
self.assertEqual(import_items[0].normalized_data["id"], "38")
self.assertEqual(import_items[0].normalized_data["title"], "Gideon the Ninth")
self.assertEqual(import_items[0].normalized_data["authors"], "Tamsyn Muir")
self.assertEqual(import_items[0].normalized_data["isbn_13"], "9781250313195")
self.assertIsNone(import_items[0].normalized_data["isbn_10"])
self.assertEqual(import_items[0].normalized_data["shelf"], "read")
self.assertEqual(import_items[1].index, 1)
self.assertEqual(import_items[1].normalized_data["id"], "48")
self.assertEqual(import_items[1].normalized_data["title"], "Harrow the Ninth")
self.assertEqual(import_items[2].index, 2)
self.assertEqual(import_items[2].normalized_data["id"], "23")
self.assertEqual(import_items[2].normalized_data["title"], "Subcutanean")
self.assertEqual(import_items[3].index, 3)
self.assertEqual(import_items[3].normalized_data["id"], "10")
self.assertEqual(import_items[3].normalized_data["title"], "Patisserie at Home")
# items don't get added in a predictable order, so we're using this weird loop
for item in import_items:
if item.index == 0:
self.assertEqual(item.normalized_data["id"], "38")
self.assertEqual(item.normalized_data["title"], "Gideon the Ninth")
self.assertEqual(item.normalized_data["authors"], "Tamsyn Muir")
self.assertEqual(item.normalized_data["isbn_13"], "9781250313195")
self.assertIsNone(item.normalized_data["isbn_10"])
self.assertEqual(item.normalized_data["shelf"], "read")
elif item.index == 1:
self.assertEqual(item.index, 1)
self.assertEqual(item.normalized_data["id"], "48")
self.assertEqual(item.normalized_data["title"], "Harrow the Ninth")
elif item.index == 2:
self.assertEqual(item.index, 2)
self.assertEqual(item.normalized_data["id"], "23")
self.assertEqual(item.normalized_data["title"], "Subcutanean")
elif item.index == 3:
self.assertEqual(item.index, 3)
self.assertEqual(item.normalized_data["id"], "10")
self.assertEqual(item.normalized_data["title"], "Patisserie at Home")
def test_create_retry_job(self, *_):
"""trying again with items that didn't import"""