def test_search_bookstore_by_book_title(self): store = Bookstore("Rmotr's bookstore") store.add_book(self.ficciones) store.add_book(self.aleph) results = store.search_books(title='XYZ') self.assertEqual(results, []) results = store.search_books(title='ficc') self.assertEqual(results, [self.ficciones]) results = store.search_books(title='The') self.assertEqual(results, [self.aleph]) store.add_book(self.raven) results = store.search_books(title='The') self.assertEqual(results, [self.aleph, self.raven])
def test_search_bookstore_by_book_author(self): store = Bookstore("Rmotr's bookstore") store.add_book(self.ficciones) store.add_book(self.aleph) austen = Author('Jane Austen', 'UK') results = store.search_books(author=austen) self.assertEqual(results, []) results = store.search_books(author=self.borges) self.assertEqual(results, [self.ficciones, self.aleph]) results = store.search_books(author=self.poe) self.assertEqual(results, []) store.add_book(self.raven) results = store.search_books(author=self.poe) self.assertEqual(results, [self.raven])
def test_instantiate_bookstore(self): store = Bookstore("Rmotr's bookstore") self.assertEqual(store.name, "Rmotr's bookstore") self.assertEqual(store.get_books(), [])
def test_add_book_to_bookstore(self): store = Bookstore("Rmotr's bookstore") self.assertEqual(store.get_books(), []) store.add_book(self.ficciones) self.assertEqual(store.get_books(), [self.ficciones]) store.add_book(self.raven) self.assertEqual(store.get_books(), [self.ficciones, self.raven]) # Test second store second_store = Bookstore("Second bookstore") self.assertEqual(second_store.get_books(), []) second_store.add_book(self.raven) self.assertEqual(second_store.get_books(), [self.raven])
def test_search_bookstore_by_book_title(self): store = Bookstore("Rmotr's bookstore") store.add_book(self.ficciones) store.add_book(self.aleph) results = store.search_books(title='XYZ') self.assertEqual(results, []) results = store.search_books(title='ficc') self.assertEqual(results, [self.ficciones]) ''' results = [] store.books = [ficciones, aleph] books[1] = ficciones if 'ficc' in books[1].title.lower(): results.append(books[1]) return results ''' results = store.search_books(title='The') self.assertEqual(results, [self.aleph]) store.add_book(self.raven) results = store.search_books(title='The') self.assertEqual(results, [self.aleph, self.raven])
def test_search_bookstore_by_book_author(fixtures): store = Bookstore("Rmotr's bookstore") store.add_book(fixtures.ficciones) store.add_book(fixtures.aleph) austen = Author('Jane Austen', 'UK') results = store.search_books(author=austen) assert results == [] results = store.search_books(author=fixtures.borges) assert results == [fixtures.ficciones, fixtures.aleph] results = store.search_books(author=fixtures.poe) assert results == [] store.add_book(fixtures.raven) results = store.search_books(author=fixtures.poe) assert results == [fixtures.raven]
def test_search_bookstore_by_book_title(fixtures): store = Bookstore("Rmotr's bookstore") store.add_book(fixtures.ficciones) store.add_book(fixtures.aleph) results = store.search_books(title='XYZ') assert results == [] results = store.search_books(title='ficc') assert results == [fixtures.ficciones] results = store.search_books(title='The') assert results == [fixtures.aleph] store.add_book(fixtures.raven) results = store.search_books(title='The') assert results == [fixtures.aleph, fixtures.raven]
def test_add_book_to_bookstore(fixtures): store = Bookstore("Rmotr's bookstore") assert store.get_books() == [] store.add_book(fixtures.ficciones) assert store.get_books() == [fixtures.ficciones] store.add_book(fixtures.raven) assert store.get_books() == [fixtures.ficciones, fixtures.raven] # Test second store second_store = Bookstore("Second bookstore") assert second_store.get_books() == [] second_store.add_book(fixtures.raven) assert second_store.get_books() == [fixtures.raven]
def test_instantiate_bookstore(): store = Bookstore("Rmotr's bookstore") assert store.name == "Rmotr's bookstore" assert store.get_books() == []