test(itam): test meta attribute itam_sub_model_type for ITAMBaseModel

ref: #742 #692
This commit is contained in:
2025-05-08 15:09:28 +09:30
parent 1058659174
commit e30c08fd5b

View File

@ -12,6 +12,8 @@ class ITAMAssetBaseModelTestCases(
kwargs_create_item: dict = {}
it_asset_base_model = ITAMAssetBase
sub_model_type = 'itam_base'
"""Sub Model Type
@ -39,6 +41,36 @@ class ITAMAssetBaseModelTestCases(
assert issubclass(self.model, ITAMAssetBase)
def test_attribute_meta_exists_itam_sub_model_type(self):
"""Attribute check
meta.itam_sub_model_type must exist
"""
assert hasattr(self.model()._meta, 'itam_sub_model_type')
def test_sanity_is_it_asset_sub_model(self):
"""Sanity Test
This test ensures that the model being tested `self.model` is a
sub-model of `self.it_asset_base_model`.
This test is required as the same viewset is used for all sub-models
of `ITAMAssetBase`
"""
assert issubclass(self.model, self.it_asset_base_model)
def test_attribute_meta_type_itam_sub_model_type(self):
"""Attribute type
meta.itam_sub_model_type must be of type str
"""
assert type(self.model()._meta.itam_sub_model_type) is str
def test_attribute_type_app_namespace(self):
"""Attribute Type