@ -7,7 +7,7 @@ from centurion.tests.unit_models import ModelTestCases
|
||||
from access.models.tenancy_abstract import TenancyAbstractModel
|
||||
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
@pytest.mark.tenancy_models
|
||||
class TenancyAbstractModelTestCases(
|
||||
ModelTestCases
|
||||
@ -81,6 +81,7 @@ class TenancyAbstractModelInheritedCases(
|
||||
|
||||
|
||||
|
||||
@pytest.mark.module_access
|
||||
class TenancyAbstractModelPyTest(
|
||||
TenancyAbstractModelTestCases,
|
||||
):
|
||||
|
@ -2,16 +2,12 @@ import pytest
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
from core.tests.unit.centurion_abstract.test_unit_centurion_abstract_model import (
|
||||
CenturionAbstractModelInheritedCases
|
||||
)
|
||||
from core.tests.unit.mixin_centurion.test_unit_centurion_mixin import (
|
||||
CenturionMixnInheritedCases,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@pytest.mark.module_access
|
||||
@pytest.mark.model_tenant
|
||||
class TenantModelTestCases(
|
||||
CenturionMixnInheritedCases
|
||||
|
@ -7,7 +7,7 @@ from api.tests.functional.test_functional_permissions_api import (
|
||||
APIPermissionsInheritedCases
|
||||
)
|
||||
|
||||
from core.models.centurion import CenturionModel
|
||||
from core.mixins.centurion import Centurion
|
||||
|
||||
|
||||
|
||||
@ -111,13 +111,14 @@ exclude_model_from_test = [
|
||||
'ConfigGroupHosts', # No API Endpoint
|
||||
]
|
||||
|
||||
|
||||
class APIPermissionsTestCases(
|
||||
APIPermissionsInheritedCases
|
||||
):
|
||||
"""API Permission Test Cases
|
||||
|
||||
This test suite is dynamically created for `CenturionModel` sub-classes.
|
||||
Each `CenturionModel` must ensure their model fixture exists in
|
||||
This test suite is dynamically created for `Centurion` sub-classes.
|
||||
Each `Centurion` must ensure their model fixture exists in
|
||||
`tests/fixtures/model_<model_name>` with fixtures `model_<model_name>` and
|
||||
`kwargs_<model_name>` defined.
|
||||
"""
|
||||
@ -134,8 +135,8 @@ for centurion_model in get_models(
|
||||
):
|
||||
|
||||
if(
|
||||
not issubclass(centurion_model, CenturionModel)
|
||||
or centurion_model == CenturionModel
|
||||
not issubclass(centurion_model, Centurion)
|
||||
or centurion_model == Centurion
|
||||
or centurion_model._meta.object_name in exclude_model_from_test
|
||||
):
|
||||
continue
|
||||
@ -167,5 +168,6 @@ for centurion_model in get_models(
|
||||
|
||||
model_mark = f'model_{model_name}'
|
||||
dynamic_class = pytest.mark.__getattr__(model_mark)(dynamic_class)
|
||||
dynamic_class = pytest.mark.__getattr__('module_'+centurion_model._meta.app_label)(dynamic_class)
|
||||
|
||||
globals()[cls_name] = dynamic_class
|
||||
|
@ -13,7 +13,7 @@ from core.models.centurion import CenturionModel
|
||||
|
||||
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
@pytest.mark.centurion_models
|
||||
class CenturionAbstractModelTestCases(
|
||||
CenturionMixnInheritedCases,
|
||||
|
@ -171,7 +171,7 @@ for model in get_models():
|
||||
|
||||
cls_name: str = f"{model._meta.object_name}MetaModelPyTest"
|
||||
|
||||
globals()[cls_name] = type(
|
||||
dynamic_class = type(
|
||||
cls_name,
|
||||
(AuditHistoryMetaModelTestCases,),
|
||||
{
|
||||
@ -182,3 +182,8 @@ for model in get_models():
|
||||
'model_class': model
|
||||
}
|
||||
)
|
||||
|
||||
dynamic_class = pytest.mark.__getattr__('model_' + model._meta.model_name)(dynamic_class)
|
||||
dynamic_class = pytest.mark.__getattr__('module_' + model._meta.app_label)(dynamic_class)
|
||||
|
||||
globals()[cls_name] = dynamic_class
|
||||
|
@ -170,7 +170,7 @@ for model in get_models():
|
||||
|
||||
cls_name: str = f"{model._meta.object_name}MetaModelPyTest"
|
||||
|
||||
globals()[cls_name] = type(
|
||||
dynamic_class = type(
|
||||
cls_name,
|
||||
(ModelNotesMetaModelTestCases,),
|
||||
{
|
||||
@ -181,3 +181,8 @@ for model in get_models():
|
||||
'model_class': model
|
||||
}
|
||||
)
|
||||
|
||||
dynamic_class = pytest.mark.__getattr__('model_' + model._meta.model_name)(dynamic_class)
|
||||
dynamic_class = pytest.mark.__getattr__('module_' + model._meta.app_label)(dynamic_class)
|
||||
|
||||
globals()[cls_name] = dynamic_class
|
||||
|
@ -1088,6 +1088,19 @@ markers = [
|
||||
"model_tenant: Select all Tentant model tests.",
|
||||
"model_ticketcategory: Select all Ticket Categeory tests.",
|
||||
"model_ticketcommentcategory: select all ticket comment category tests.",
|
||||
"module_access: Selects all tests from module access.",
|
||||
"module_accounting: Selects all tests from module accounting.",
|
||||
"module_api: Selects all tests from module api.",
|
||||
"module_assistance: Selects all tests from module assistance.",
|
||||
"module_config_management: Selects all tests from module config management.",
|
||||
"module_core: Selects all tests from module core.",
|
||||
"module_devops: Selects all tests from module devops.",
|
||||
"module_human_resources: Selects all tests from module human resources.",
|
||||
"module_itam: Selects all tests from module ITAM.",
|
||||
"module_itim: Selects all tests from module ITIM.",
|
||||
"module_itops: Selects all tests from module IT OPS.",
|
||||
"module_project_management: Selects all tests from module Project Management.",
|
||||
"module_setings: Selects all tests from module settings.",
|
||||
"note_models: Selects all centurion model note models",
|
||||
"permissions: selects all permission related tests.",
|
||||
"tenancy_models: Selects Tenancy models.",
|
||||
|
Reference in New Issue
Block a user