fix connecting

This commit is contained in:
collerek
2020-12-07 13:08:07 +01:00
parent 5f1ee7ad9c
commit f08ae49834

View File

@ -46,9 +46,11 @@ def create_test_database():
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_model_relationship(): async def test_model_relationship():
cat = await Category(name="Foo", code=123).save() async with db:
ws = await Workshop(topic="Topic 1", category=cat).save() async with db.transaction(force_rollback=True):
cat = await Category(name="Foo", code=123).save()
ws = await Workshop(topic="Topic 1", category=cat).save()
assert ws.id == 1 assert ws.id == 1
assert ws.topic == "Topic 1" assert ws.topic == "Topic 1"
assert ws.category.name == "Foo" assert ws.category.name == "Foo"