55
66# Test data constants
77TEST_BOOKS = [
8- {"title" : "Carrie" , "author" : "Stephen King" },
9- {"title" : "Ready Player One" , "author" : "Ernest Cline" },
8+ {"title" : "Carrie" , "author" : "Stephen King" , "publisher" : "Scribner" },
9+ {"title" : "Ready Player One" , "author" : "Ernest Cline" , "publisher" : "Crown Publishing Group" },
1010]
1111
1212class TestMainApp :
@@ -26,6 +26,7 @@ def test_create_book(self, test_db):
2626 book = create_book (test_db , BookIn (** TEST_BOOKS [0 ]))
2727 assert book .title == TEST_BOOKS [0 ]["title" ]
2828 assert book .author == TEST_BOOKS [0 ]["author" ]
29+ assert book .publisher == TEST_BOOKS [0 ]["publisher" ]
2930 assert book .id is not None
3031
3132 def test_get_books (self , test_db ):
@@ -57,7 +58,7 @@ def test_update_book(self, test_db):
5758
5859 def test_delete_book (self , test_db ):
5960 """Test deleting a book"""
60- book = create_book (test_db , BookIn (title = "To Delete" , author = "Author" ))
61+ book = create_book (test_db , BookIn (title = "To Delete" , author = "Author" , publisher = "Unknown" ))
6162 deleted_book = delete_book (test_db , book .id )
6263
6364 assert deleted_book is not None
@@ -67,5 +68,5 @@ def test_delete_book(self, test_db):
6768 def test_nonexistent_operations (self , test_db ):
6869 """Test operations on nonexistent books"""
6970 assert get_book (test_db , 999999 ) is None
70- assert update_book (test_db , 999999 , BookIn (title = "Test" , author = "Test" )) is None
71+ assert update_book (test_db , 999999 , BookIn (title = "Test" , author = "Test" , publisher = "Test Publisher" )) is None
7172 assert delete_book (test_db , 999999 ) is None
0 commit comments