test(core): Add Base Centurion model Functional Test Suite
ref: #773 #767
This commit is contained in:
14
app/core/tests/functional/centurion_abstract/conftest.py
Normal file
14
app/core/tests/functional/centurion_abstract/conftest.py
Normal file
@ -0,0 +1,14 @@
|
||||
import pytest
|
||||
|
||||
from core.models.centurion import CenturionModel
|
||||
|
||||
|
||||
|
||||
@pytest.fixture( scope = 'class')
|
||||
def model(request):
|
||||
|
||||
request.cls.model = CenturionModel
|
||||
|
||||
yield request.cls.model
|
||||
|
||||
del request.cls.model
|
@ -0,0 +1,61 @@
|
||||
import pytest
|
||||
|
||||
from django.apps import apps
|
||||
|
||||
from access.tests.functional.tenancy_abstract.test_functional_tenancy_abstract_model import (
|
||||
TenancyAbstractModelInheritedCases
|
||||
)
|
||||
|
||||
|
||||
|
||||
@pytest.mark.centurion_models
|
||||
class CenturionAbstractModelTestCases(
|
||||
TenancyAbstractModelInheritedCases
|
||||
):
|
||||
|
||||
|
||||
kwargs_create_item = {
|
||||
'model_notes': 'model notes txt',
|
||||
'created': '2025-05-23T00:00',
|
||||
}
|
||||
|
||||
|
||||
|
||||
def test_model_create_has_history_entry(self, content_type, created_model, model):
|
||||
"""Model Created
|
||||
|
||||
Ensure that the model when created, added a `create` Audit History
|
||||
entry.
|
||||
"""
|
||||
|
||||
if model._meta.abstract:
|
||||
|
||||
pytest.xfail( reason = 'Model is an Abstract Model and can not be created.' )
|
||||
|
||||
|
||||
history_model = apps.get_model( created_model._meta.app_label, created_model.get_history_model_name() )
|
||||
|
||||
entry = history_model.objects.get(
|
||||
model = created_model,
|
||||
content_type = content_type.objects.get(
|
||||
app_label = created_model._meta.app_label,
|
||||
model = created_model._meta.model_name
|
||||
)
|
||||
)
|
||||
|
||||
assert entry.model == created_model
|
||||
|
||||
|
||||
|
||||
class CenturionAbstractModelInheritedCases(
|
||||
CenturionAbstractModelTestCases,
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
class CenturionAbstractModelPyTest(
|
||||
CenturionAbstractModelTestCases,
|
||||
):
|
||||
|
||||
pass
|
Reference in New Issue
Block a user