test(itam): API Field Checks for Software Version History

ref: #605 #625
This commit is contained in:
2025-02-17 06:32:19 +09:30
parent 1ddfd852d4
commit 58cca3e954

View File

@ -0,0 +1,48 @@
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from core.tests.abstract.test_unit_model_history_api_v2 import PrimaryModelHistoryAPI
from itam.models.software import Software
from itam.models.software_version_history import SoftwareVersion, SoftwareVersionHistory
class ModelHistoryAPI(
PrimaryModelHistoryAPI,
TestCase,
):
audit_model = SoftwareVersion
model = SoftwareVersionHistory
@classmethod
def setUpTestData(self):
super().setUpTestData()
self.audit_object = self.audit_model.objects.create(
organization = self.organization,
name = 'one',
software = Software.objects.create(
organization = self.organization,
name = 'one',
),
)
self.history_entry = self.model.objects.create(
organization = self.audit_object.organization,
action = self.model.Actions.ADD,
user = self.view_user,
before = {},
after = {},
content_type = ContentType.objects.get(
app_label = self.audit_object._meta.app_label,
model = self.audit_object._meta.model_name,
),
model = self.audit_object,
)
self.make_request()