mirror of
https://github.com/wowlikon/LibraryAPI.git
synced 2025-12-11 21:30:46 +00:00
Добавление жанров, дополнение описания
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user