Добавление жанров, дополнение описания

This commit is contained in:
2025-10-20 22:24:00 +03:00
parent 9604771439
commit ddcae6cdf6
13 changed files with 147 additions and 136 deletions

View File

@@ -9,10 +9,14 @@ from tests.test_misc import setup_database
client = TestClient(app)
def make_relationship(author_id, book_id):
def make_authorbook_relationship(author_id, book_id):
response = client.post("/relationships/author-book", params={"author_id": author_id, "book_id": book_id})
assert response.status_code == 200, "Invalid response status"
def make_genrebook_relationship(author_id, book_id):
response = client.post("/relationships/genre-book", params={"genre_id": author_id, "book_id": book_id})
assert response.status_code == 200, "Invalid response status"
def test_prepare_data(setup_database):
response = client.post("/books", json={"title": "Test Book 1", "description": "Test Description 1"})
response = client.post("/books", json={"title": "Test Book 2", "description": "Test Description 2"})
@@ -22,11 +26,11 @@ def test_prepare_data(setup_database):
response = client.post("/authors", json={"name": "Test Author 2"})
response = client.post("/authors", json={"name": "Test Author 3"})
make_relationship(1, 1)
make_relationship(2, 1)
make_relationship(1, 2)
make_relationship(2, 3)
make_relationship(3, 3)
make_authorbook_relationship(1, 1)
make_authorbook_relationship(2, 1)
make_authorbook_relationship(1, 2)
make_authorbook_relationship(2, 3)
make_authorbook_relationship(3, 3)
response = client.get("/relationships/author-book")
assert response.status_code == 200, "Invalid response status"