add test with valid isbn10

This commit is contained in:
Willi Hohenstein 2022-02-13 17:10:32 +01:00
parent 5801ef011f
commit a4b08d7213

View file

@ -28,6 +28,7 @@ class BookSearch(TestCase):
openlibrary_key="hello",
)
# isbn13 entry
self.third_edition = models.Edition.objects.create(
title="Python Testing",
parent_work=self.work,
@ -36,6 +37,15 @@ class BookSearch(TestCase):
published_date=datetime.datetime(2017, 9, 1, 0, 0, tzinfo=timezone.utc),
)
# isbn10 entry
self.fourth_edition = models.Edition.objects.create(
title="Pride and Prejudice: Jane Austen",
parent_work=self.work,
isbn_13="190962165X",
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
@ -56,6 +66,10 @@ class BookSearch(TestCase):
self.assertEqual(len(results), 1)
self.assertEqual(results[0], self.third_edition)
results = book_search.search("1-9096-2165-X")
self.assertEqual(len(results), 1)
self.assertEqual(results[0], self.fourth_edition)
# identifier
results = book_search.search("hello")
self.assertEqual(len(results), 1)