@@ -19,7 +19,8 @@ def test_entity_create(entity_class):
1919 assert test_indicator is not None , "Response is NoneType"
2020 assert "id" in test_indicator , "No ID on object"
2121 finally :
22- entity_class .base_class ().delete (id = test_indicator ["id" ])
22+ if test_indicator and "id" in test_indicator :
23+ entity_class .base_class ().delete (id = test_indicator ["id" ])
2324
2425
2526def test_read (entity_class ):
@@ -37,7 +38,8 @@ def test_read(entity_class):
3738 )
3839
3940 finally :
40- entity_class .base_class ().delete (id = test_indicator ["id" ])
41+ if test_indicator and "id" in test_indicator :
42+ entity_class .base_class ().delete (id = test_indicator ["id" ])
4143
4244
4345def test_update (entity_class ):
@@ -73,7 +75,8 @@ def test_update(entity_class):
7375 result = test_indicator
7476
7577 finally :
76- entity_class .base_class ().delete (id = result ["id" ])
78+ if test_indicator and "id" in test_indicator :
79+ entity_class .base_class ().delete (id = result ["id" ])
7780
7881
7982def test_delete (entity_class ):
@@ -87,7 +90,8 @@ def test_delete(entity_class):
8790 result = entity_class .own_class ().read (id = test_indicator ["id" ])
8891 assert result is None , f"Read returned value '{ result } ' after delete"
8992 except AssertionError :
90- entity_class .base_class ().delete (id = test_indicator ["id" ])
93+ if test_indicator and "id" in test_indicator :
94+ entity_class .base_class ().delete (id = test_indicator ["id" ])
9195
9296
9397def test_filter (entity_class ):
@@ -108,7 +112,8 @@ def test_filter(entity_class):
108112 entity_class .get_compare_exception_keys (),
109113 )
110114 finally :
111- entity_class .base_class ().delete (id = test_indicator ["id" ])
115+ if test_indicator and "id" in test_indicator :
116+ entity_class .base_class ().delete (id = test_indicator ["id" ])
112117
113118
114119def test_search (entity_class ):
@@ -127,7 +132,8 @@ def test_search(entity_class):
127132 entity_class .get_compare_exception_keys (),
128133 )
129134 finally :
130- entity_class .base_class ().delete (id = test_indicator ["id" ])
135+ if test_indicator and "id" in test_indicator :
136+ entity_class .base_class ().delete (id = test_indicator ["id" ])
131137
132138
133139def test_relation (entity_class ):
@@ -153,5 +159,7 @@ def test_relation(entity_class):
153159 result = entity_class .own_class ().read (id = test_indicator ["id" ])
154160 assert len (result ["objectsIds" ]) == 0
155161 finally :
156- entity_class .base_class ().delete (id = test_indicator ["id" ])
157- entity_class .base_class ().delete (id = test_indicator2 ["id" ])
162+ if test_indicator and "id" in test_indicator :
163+ entity_class .base_class ().delete (id = test_indicator ["id" ])
164+ if test_indicator2 and "id" in test_indicator2 :
165+ entity_class .base_class ().delete (id = test_indicator2 ["id" ])
0 commit comments