add missing connection in tests

This commit is contained in:
collerek
2021-05-18 13:38:02 +02:00
parent 57803ac8e6
commit 7d94e13d21

View File

@ -73,11 +73,12 @@ def create_test_database():
@pytest.fixture() @pytest.fixture()
async def sample_data(): async def sample_data():
country = await Country(id=1, name="USA").save() async with database:
author = await Author(id=1, name="bug", rating=5, country=country).save() country = await Country(id=1, name="USA").save()
await Book( author = await Author(id=1, name="bug", rating=5, country=country).save()
id=1, author=author, title="Bug caused by default value", year=2021 await Book(
).save() id=1, author=author, title="Bug caused by default value", year=2021
).save()
@app.get("/books/{book_id}", response_model=Book) @app.get("/books/{book_id}", response_model=Book)