add test for dashed ISBN

This commit is contained in:
Willi Hohenstein 2022-02-13 09:34:28 +01:00
parent 67ea18c840
commit 27c26b4d16

View file

@ -28,6 +28,14 @@ class BookSearch(TestCase):
openlibrary_key="hello",
)
self.third_edition = models.Edition.objects.create(
title="Python Testing",
parent_work=self.work,
isbn_13="9781680502404",
physical_format="Paperback",
published_date=datetime.datetime(2017, 9, 1, 0, 0, tzinfo=timezone.utc),
)
def test_search(self):
"""search for a book in the db"""
# title/author
@ -39,6 +47,14 @@ class BookSearch(TestCase):
results = book_search.search("0000000000")
self.assertEqual(len(results), 1)
self.assertEqual(results[0], self.first_edition)
results = book_search.search("9781680502404")
self.assertEqual(len(results), 1)
self.assertEqual(results[0], self.third_edition)
results = book_search.search("9-781-68050-2-404")
self.assertEqual(len(results), 1)
self.assertEqual(results[0], self.third_edition)
# identifier
results = book_search.search("hello")