test(core): Unit Model Test Cases for CenturionSubAbstract model

ref: #772 #767
This commit is contained in:
2025-05-25 02:52:58 +09:30
parent 16bbb3328b
commit 8b62014d88
3 changed files with 49 additions and 34 deletions

View File

@ -31,27 +31,30 @@ class CenturionAbstractModelTestCases(
parameterized_class_attributes = {
'_audit_enabled': {
'type': bool,
'value': True,
},
'_is_submodel': {
'type': bool,
'value': False,
},
'_notes_enabled': {
'type': bool,
'value': True,
},
'context': {
'type': dict,
'value': {
'logger': None,
'user': None,
@property
def parameterized_class_attributes(self):
return {
'_audit_enabled': {
'type': bool,
'value': True,
},
'_is_submodel': {
'type': bool,
'value': False,
},
'_notes_enabled': {
'type': bool,
'value': True,
},
'context': {
'type': dict,
'value': {
'logger': None,
'user': None,
}
}
}
}
parameterized_model_fields = {

View File

@ -1,14 +1,10 @@
# import pytest
import pytest
# from core.models.centurion import CenturionSubModel
from core.models.centurion import CenturionSubModel
# @pytest.fixture( scope = 'class')
# def model(request):
@pytest.fixture( scope = 'class')
def model(request):
# request.cls.model = CenturionSubModel
# yield request.cls.model
# del request.cls.model
yield CenturionSubModel

View File

@ -1,18 +1,31 @@
import pytest
from core.tests.unit.centurion_abstract.test_unit_centurion_abstract_model import (
CenturionAbstractModelTestCases,
CenturionAbstractModelInheritedCases,
)
@pytest.mark.models
class CenturionSubAbstractModelTestCases:
@pytest.mark.unit
class CenturionSubAbstractModelTestCases(
CenturionAbstractModelTestCases
):
parameterized_class_attributes = {
'_is_submodel': {
'value': True,
}
}
# @pytest.fixture( scope = 'class', autouse = True)
# def setup_class(cls, model):
# pass
pass
class CenturionSubAbstractModelInheritedCases(
CenturionSubAbstractModelTestCases,
CenturionAbstractModelInheritedCases,
):
pass
@ -22,4 +35,7 @@ class CenturionSubAbstractModelInheritedCases(
class CenturionSubAbstractModelPyTest(
CenturionSubAbstractModelTestCases,
):
pass
def test_model_is_abstract(self, model):
assert model._meta.abstract