From 0bf5485025ddc6a932e8a862959d287aa610ceb8 Mon Sep 17 00:00:00 2001 From: collerek Date: Thu, 11 Feb 2021 11:29:16 +0100 Subject: [PATCH] add connection to test --- tests/test_json_field_fastapi.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/test_json_field_fastapi.py b/tests/test_json_field_fastapi.py index 0569c0c..a64a163 100644 --- a/tests/test_json_field_fastapi.py +++ b/tests/test_json_field_fastapi.py @@ -115,15 +115,16 @@ async def test_json_is_not_required_if_nullable(): @pytest.mark.asyncio async def test_setting_values_after_init(): - t1 = Thing(id="67a82813-d90c-45ff-b546-b4e38d7030d7", name="t1", js=["thing1"]) - assert '["thing1"]' in t1.json() - await t1.save() - t1.json() - assert '["thing1"]' in t1.json() + async with database: + t1 = Thing(id="67a82813-d90c-45ff-b546-b4e38d7030d7", name="t1", js=["thing1"]) + assert '["thing1"]' in t1.json() + await t1.save() + t1.json() + assert '["thing1"]' in t1.json() - assert '["thing1"]' in (await Thing.objects.get(id=t1.id)).json() - await t1.update() - assert '["thing1"]' in (await Thing.objects.get(id=t1.id)).json() + assert '["thing1"]' in (await Thing.objects.get(id=t1.id)).json() + await t1.update() + assert '["thing1"]' in (await Thing.objects.get(id=t1.id)).json() def test_read_main():