From 7d94e13d21b027af06d35790667c46c7a4d51e80 Mon Sep 17 00:00:00 2001 From: collerek Date: Tue, 18 May 2021 13:38:02 +0200 Subject: [PATCH] add missing connection in tests --- .../test_relations_with_nested_defaults.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/test_fastapi/test_relations_with_nested_defaults.py b/tests/test_fastapi/test_relations_with_nested_defaults.py index d0d11c8..3e7fab9 100644 --- a/tests/test_fastapi/test_relations_with_nested_defaults.py +++ b/tests/test_fastapi/test_relations_with_nested_defaults.py @@ -73,11 +73,12 @@ def create_test_database(): @pytest.fixture() async def sample_data(): - country = await Country(id=1, name="USA").save() - author = await Author(id=1, name="bug", rating=5, country=country).save() - await Book( - id=1, author=author, title="Bug caused by default value", year=2021 - ).save() + async with database: + country = await Country(id=1, name="USA").save() + author = await Author(id=1, name="bug", rating=5, country=country).save() + await Book( + id=1, author=author, title="Bug caused by default value", year=2021 + ).save() @app.get("/books/{book_id}", response_model=Book)