From 5b427590112562a88ee2f08c5cffc2830afa84ef Mon Sep 17 00:00:00 2001 From: Bram Jans Date: Tue, 28 May 2024 16:40:56 +0200 Subject: [PATCH] IA-3039 Fix test --- iaso/tests/api/test_entities.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/iaso/tests/api/test_entities.py b/iaso/tests/api/test_entities.py index aa0c6cc1d9..da8295f341 100644 --- a/iaso/tests/api/test_entities.py +++ b/iaso/tests/api/test_entities.py @@ -792,12 +792,16 @@ def test_retrieve_entities_user_geo_restrictions(self): entity_type = EntityType.objects.create(name="Type 1", reference_form=self.form_1, account=self.star_wars) # Village 1 (district 1): instance + entity - instance = Instance.objects.create(org_unit=village_1, form=self.form_1, period="202002") - Entity.objects.create(entity_type=entity_type, attributes=instance, account=self.star_wars) + instance_1 = Instance.objects.create(org_unit=village_1, form=self.form_1, period="202002") + entity = Entity.objects.create(entity_type=entity_type, attributes=instance_1, account=self.star_wars) + instance_1.entity = entity + instance_1.save() # Village 2 (district 2): instance + entity - second_instance = Instance.objects.create(org_unit=village_2, form=self.form_1, period="202002") - Entity.objects.create(entity_type=entity_type, attributes=second_instance, account=self.star_wars) + instance_2 = Instance.objects.create(org_unit=village_2, form=self.form_1, period="202002") + entity_2 = Entity.objects.create(entity_type=entity_type, attributes=instance_2, account=self.star_wars) + instance_2.entity = entity_2 + instance_2.save() response = self.client.get("/api/entities/", format="json")