From 4fda640832e9112fe011dd826275d76517d67ea1 Mon Sep 17 00:00:00 2001 From: Jon Date: Sat, 7 Jun 2025 15:40:22 +0930 Subject: [PATCH] chore: for mode instance, actually create it ref: #804 --- app/centurion/tests/unit_models.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/centurion/tests/unit_models.py b/app/centurion/tests/unit_models.py index 92f01b62..737f4063 100644 --- a/app/centurion/tests/unit_models.py +++ b/app/centurion/tests/unit_models.py @@ -92,7 +92,7 @@ class ModelTestCases( @pytest.fixture( scope = 'function', autouse = True) - def model_instance(cls, request, model): + def model_instance(cls, request, model, model_kwargs): if model._meta.abstract: @@ -106,10 +106,14 @@ class ModelTestCases( else: - instance = model() + instance = model.objects.create( **model_kwargs ) yield instance + if instance.id: + + instance.delete() + del instance if 'mockmodel' in apps.all_models['core']: