Skip to content

Commit

Permalink
test(itam): ensure history is removed on software delete
Browse files Browse the repository at this point in the history
!27 #15
  • Loading branch information
jon-nfc committed Jun 15, 2024
1 parent 5280db8 commit 92fe05d
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions app/itam/tests/software/test_software_core_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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

0 comments on commit 92fe05d

Please sign in to comment.