test: Consolidate All model tests to remove duplicates and to simplify

ref: #719 #708
This commit is contained in:
2025-04-13 01:02:15 +09:30
parent 507c42faea
commit e4588771e8
32 changed files with 1393 additions and 1225 deletions

View File

@ -8,8 +8,6 @@ about: https://gitlab.com/nofusscomputing/infrastructure/configuration-managemen
Models are tested using the following test cases:
- [Models](./models.md)
- [ALL Model Permission](./model_permissions.md)
- [ALL Model Permission (organization Manager)](./model_permissions_organization_manager.md)
@ -32,6 +30,4 @@ Models are tested using the following test cases:
- [Model Views](./model_views.md)
- [Tenancy Objects](./model_tenancy_object.md)
The above test cases are common to alot of models and function of this application and are intended to be inherited by your test class.

View File

@ -1,9 +0,0 @@
---
title: Tenancy Object Entry Test Cases
description: No Fuss Computings model TenancyObject unit test cases
date: 2024-06-20
template: project.html
about: https://gitlab.com/nofusscomputing/infrastructure/configuration-management/centurion_erp
---
::: app.access.tests.abstract.tenancy_object.TenancyObject

View File

@ -1,27 +0,0 @@
---
title: Model Test Cases
description: No Fuss Computings model nit test cases
date: 2024-07-15
template: project.html
about: https://gitlab.com/nofusscomputing/infrastructure/configuration-management/centurion_erp
---
## Base Unit Tests for all models
Abstract test class containing test cases for all models.
::: app.app.tests.abstract.models.BaseModel
options:
inherited_members: false
heading_level: 3
## Tenancy model Unit Tests
Abstract test class containing test cases for Tenancy Object models
::: app.app.tests.abstract.models.TenancyModel
options:
inherited_members: True
heading_level: 3

View File

@ -87,7 +87,8 @@ def save_history(self, before: dict, after: dict) -> bool:
As with any other object within Centurion, the addition of a feature requires it be tested. The following Test Suites are available:
- `Unit` - API Fields checks
- `Unit`
- `core.tests.unit.test_history.test_unit_history_model.ModelHistoryInheritedCases` History Models
- `core.tests.abstract.test_unit_model_history_api_v2.PrimaryModelHistoryAPI` for parent / Primary history model

View File

@ -72,12 +72,16 @@ This example is for adding notes to the Manufacturer Model
As with any other object within Centurion, the addition of a feature requires it be tested. The following Test Suites are available:
- `Unit` - `core.tests.abstract.test_unit_model_notes_model.ModelNotesModel`
- `Unit`
- `Unit` - `core.tests.abstract.test_unit_model_notes_serializer.ModelNotesSerializerTestCases`
- model - `core.tests.unit.model_notes.test_unit_model_notes.ModelNotesInheritedCases`
- `Unit` - `api.tests.abstract.viewsets`
- Serializer - `core.tests.abstract.test_unit_model_notes_serializer.ModelNotesSerializerTestCases`
- `Functional` - `core.tests.abstract.test_functional_notes_viewset`
- Viewset - `api.tests.abstract.viewsets`
- `Functional` - `core.tests.abstract.model_notes_api_fields`
- `Functional`
- ViewSet - `core.tests.abstract.test_functional_notes_viewset`
- API fields render - `core.tests.abstract.model_notes_api_fields`

View File

@ -159,9 +159,9 @@ Adding History to a model is a simple process. Please see the [Model History](./
The following Unit test cases exists for models:
- [BaseModel](./api/tests/models.md#base-unit-tests-for-all-models)
- `app.tests.unit.test_unit_models.TenancyObjectInheritedCases` for models that inherit from `access.models.tenancy.TenancyObject`
- [TenancyObject](./api/tests/models.md#tenancy-model-unit-tests)
- `app.tests.unit.test_unit_models.NonTenancyObjectInheritedCases` for models other models that **do not** inherit from `access.models.tenancy.TenancyObject`
!!! info
If you add a feature you will have to write the test cases for that feature if they are not covered by existing test cases.