diff --git a/app/itam/tests/software/test_software_core_history.py b/app/itam/tests/software/test_software_core_history.py index 840346ac..2e9ff1d2 100644 --- a/app/itam/tests/software/test_software_core_history.py +++ b/app/itam/tests/software/test_software_core_history.py @@ -131,6 +131,23 @@ def setUpTestData(self): item_class = self.model._meta.model_name, ) + self.item_delete = self.model.objects.create( + name = 'test_item_delete_' + self.model_name, + organization = self.organization + ) + + self.item_delete.delete() + + self.history_delete = History.objects.filter( + item_pk = self.item_delete.pk, + item_class = self.model._meta.model_name, + ) + + self.history_delete_children = History.objects.filter( + item_parent_pk = self.item_delete.pk, + item_parent_class = self.model._meta.model_name, + ) + # field type testing to be done as part of model testing def test_history_entry_item_add_field_action(self): @@ -233,3 +250,20 @@ def test_history_entry_item_change_field_item_class(self): # assert type(history['item_class']) is str + + +################################## Delete ################################## + + + + + def test_device_history_entry_delete(self): + """ When an item is deleted, it's history entries must be removed """ + + assert self.history_delete.exists() is False + + + def test_device_history_entry_children_delete(self): + """ When an item is deleted, it's history entries must be removed """ + + assert self.history_delete_children.exists() is False