Fix case sensitivity in tests

This commit is contained in:
2026-03-31 16:54:19 +02:00
parent c97f4c7d38
commit 4d64db45c8

View File

@@ -92,7 +92,7 @@ class TestBookAddCommand:
authors = db.session.execute(db.select(Author)).scalars().all() authors = db.session.execute(db.select(Author)).scalars().all()
assert len(authors) == 1 assert len(authors) == 1
author = authors[0] author = authors[0]
assert author.name == "J.R.R. Tolkien" assert author.name == "j.r.r. tolkien"
assert book in author.books assert book in author.books
assert author in book.authors assert author in book.authors
@@ -100,7 +100,7 @@ class TestBookAddCommand:
genres = db.session.execute(db.select(Genre)).scalars().all() genres = db.session.execute(db.select(Genre)).scalars().all()
assert len(genres) == 2 assert len(genres) == 2
genre_names = {genre.name for genre in genres} genre_names = {genre.name for genre in genres}
assert genre_names == {"Fantasy", "Adventure"} assert genre_names == {"fantasy", "adventure"}
for genre in genres: for genre in genres:
assert book in genre.books assert book in genre.books
@@ -118,7 +118,7 @@ class TestBookAddCommand:
with app.app_context(): with app.app_context():
book = db.session.execute(db.select(Book)).scalar_one() book = db.session.execute(db.select(Book)).scalar_one()
assert book.title == "Minimal Book" assert book.title == "Minimal Book"
assert book.isbn == "" # Default empty string assert book.isbn is None
assert book.publisher == "" assert book.publisher == ""
assert book.location_shelf is None # Default None assert book.location_shelf is None # Default None
assert len(book.authors) == 0 # No authors provided assert len(book.authors) == 0 # No authors provided
@@ -181,7 +181,7 @@ class TestBookListCommand:
assert len(books_data) == 1 assert len(books_data) == 1
book = books_data[0] book = books_data[0]
assert book["title"] == "Test Book" assert book["title"] == "Test Book"
assert book["authors"] == ["Test Author"] assert book["authors"] == ["test author"]
assert book["owner"] == "alice" assert book["owner"] == "alice"
assert book["isbn"] == "1234567890" assert book["isbn"] == "1234567890"
@@ -819,8 +819,8 @@ class TestWishlistCommands:
assert result.exit_code == 0 assert result.exit_code == 0
assert "Wished Book 1" in result.output assert "Wished Book 1" in result.output
assert "Wished Book 2" in result.output assert "Wished Book 2" in result.output
assert "Author One" in result.output assert "author one" in result.output
assert "Author Two" in result.output assert "author two" in result.output
def test_wishlist_list_json_format(self, app: Flask, cli_runner: CliRunner) -> None: def test_wishlist_list_json_format(self, app: Flask, cli_runner: CliRunner) -> None:
"""Test listing wishlist in JSON format.""" """Test listing wishlist in JSON format."""
@@ -852,7 +852,7 @@ class TestWishlistCommands:
assert len(wishlist_data) == 1 assert len(wishlist_data) == 1
item = wishlist_data[0] item = wishlist_data[0]
assert item["title"] == "JSON Wished Book" assert item["title"] == "JSON Wished Book"
assert item["authors"] == ["JSON Author"] assert item["authors"] == ["json author"]
class TestDatabaseCommands: class TestDatabaseCommands: