add connection to test

This commit is contained in:
collerek
2021-02-11 11:29:16 +01:00
parent ef0a4cbd49
commit 0bf5485025

View File

@ -115,15 +115,16 @@ async def test_json_is_not_required_if_nullable():
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_setting_values_after_init(): async def test_setting_values_after_init():
t1 = Thing(id="67a82813-d90c-45ff-b546-b4e38d7030d7", name="t1", js=["thing1"]) async with database:
assert '["thing1"]' in t1.json() t1 = Thing(id="67a82813-d90c-45ff-b546-b4e38d7030d7", name="t1", js=["thing1"])
await t1.save() assert '["thing1"]' in t1.json()
t1.json() await t1.save()
assert '["thing1"]' in t1.json() t1.json()
assert '["thing1"]' in t1.json()
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() 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()
def test_read_main(): def test_read_main():