add purge option to try_to_delete
diff --git a/xos/tosca/tests/basetest.py b/xos/tosca/tests/basetest.py
index f88a63b..db3ffb7 100644
--- a/xos/tosca/tests/basetest.py
+++ b/xos/tosca/tests/basetest.py
@@ -96,10 +96,13 @@
assert(False)
return obj
- def try_to_delete(self, cls, **kwargs):
- objs = cls.objects.filter(**kwargs)
- for obj in objs:
- obj.delete(purge=True)
+ def try_to_delete(self, cls, purge=True, **kwargs):
+ for obj in cls.objects.filter(**kwargs):
+ obj.delete(purge=purge)
+
+ if purge:
+ for obj in cls.deleted_objects.filter(**kwargs):
+ obj.delete(purge=True)
def execute(self, yml):
u = User.objects.get(email=self.username)