chore(access): Remove old History Tests

ref: #783 #735 #759
This commit is contained in:
2025-06-04 11:29:18 +09:30
parent 391a2f7767
commit d3f367f4b9
12 changed files with 0 additions and 686 deletions

View File

@ -1,60 +0,0 @@
from django.test import TestCase
from access.models.contact import Contact
from access.tests.functional.person.test_functional_person_history import (
PersonHistoryInheritedCases
)
class ContactTestCases(
PersonHistoryInheritedCases,
):
field_name = 'model_notes'
kwargs_create_obj: dict = {
'email': 'ipfunny@unit.test',
}
kwargs_delete_obj: dict = {
'email': 'ipweird@unit.test',
}
model = Contact
class ContactHistoryInheritedCases(
ContactTestCases,
):
model = None
"""Entity model to test"""
kwargs_create_obj: dict = None
kwargs_delete_obj: dict = None
@classmethod
def setUpTestData(self):
self.kwargs_create_obj.update(
super().kwargs_create_obj
)
self.kwargs_delete_obj.update(
super().kwargs_delete_obj
)
super().setUpTestData()
class ContactHistoryTest(
ContactTestCases,
TestCase,
):
pass

View File

@ -1,78 +0,0 @@
from django.test import TestCase
from access.models.entity_history import Entity, EntityHistory
from core.tests.abstract.test_functional_history import HistoryEntriesCommon
class HistoryTestCases(
HistoryEntriesCommon,
):
field_name = 'model_notes'
history_model = EntityHistory
kwargs_create_obj: dict = {}
kwargs_delete_obj: dict = {}
model = Entity
@classmethod
def setUpTestData(self):
super().setUpTestData()
self.obj = self.model.objects.create(
organization = self.organization,
model_notes = self.field_value_original,
**self.kwargs_create_obj,
)
self.obj_delete = self.model.objects.create(
organization = self.organization,
model_notes = 'another note',
**self.kwargs_delete_obj,
)
self.call_the_banners()
class EntityHistoryInheritedCases(
HistoryTestCases,
):
model = None
"""Entity model to test"""
kwargs_create_obj: dict = None
kwargs_delete_obj: dict = None
@classmethod
def setUpTestData(self):
self.kwargs_create_obj.update(
super().kwargs_create_obj
)
self.kwargs_delete_obj.update(
super().kwargs_delete_obj
)
super().setUpTestData()
class EntityHistoryTest(
HistoryTestCases,
TestCase,
):
pass

View File

@ -1,32 +0,0 @@
from django.test import TestCase
from access.models.organization_history import Tenant as Organization, OrganizationHistory
from core.tests.abstract.test_functional_history import HistoryEntriesCommon
class History(
HistoryEntriesCommon,
TestCase,
):
model = Organization
history_model = OrganizationHistory
@classmethod
def setUpTestData(self):
super().setUpTestData()
self.obj = self.model.objects.create(
name = self.field_value_original,
)
self.obj_delete = self.model.objects.create(
name = self.field_value_delete,
)
self.call_the_banners()

View File

@ -1,65 +0,0 @@
from django.test import TestCase
from access.models.person import Person
from access.tests.functional.entity.test_functional_entity_history import (
EntityHistoryInheritedCases
)
class PersonTestCases(
EntityHistoryInheritedCases,
):
field_name = 'model_notes'
kwargs_create_obj: dict = {
'f_name': 'Ian',
'm_name': 'Peter',
'l_name': 'Funny',
'dob': '2025-04-08',
}
kwargs_delete_obj: dict = {
'f_name': 'Ian',
'm_name': 'Peter',
'l_name': 'Weird',
'dob': '2025-04-08',
}
model = Person
class PersonHistoryInheritedCases(
PersonTestCases,
):
model = None
"""Entity model to test"""
kwargs_create_obj: dict = None
kwargs_delete_obj: dict = None
@classmethod
def setUpTestData(self):
self.kwargs_create_obj.update(
super().kwargs_create_obj
)
self.kwargs_delete_obj.update(
super().kwargs_delete_obj
)
super().setUpTestData()
class PersonHistoryTest(
PersonTestCases,
TestCase,
):
pass

View File

@ -1,55 +0,0 @@
from django.test import TestCase
from access.models.role_history import Role, RoleHistory
from core.tests.abstract.test_functional_history import HistoryEntriesCommon
class HistoryTestCases(
HistoryEntriesCommon,
):
history_model = RoleHistory
kwargs_create_obj: dict = {}
kwargs_delete_obj: dict = {}
model = Role
@classmethod
def setUpTestData(self):
super().setUpTestData()
self.obj = self.model.objects.create(
organization = self.organization,
model_notes = self.field_value_original,
**self.kwargs_create_obj,
)
self.obj_delete = self.model.objects.create(
organization = self.organization,
model_notes = 'another note',
**self.kwargs_delete_obj,
)
self.call_the_banners()
class RoleHistoryTest(
HistoryTestCases,
TestCase,
):
kwargs_create_obj: dict = {
'name': 'original_name'
}
kwargs_delete_obj: dict = {
'name': 'delete obj'
}

View File

@ -1,37 +0,0 @@
from django.test import TestCase
from access.models.team_history import Team, TeamHistory
from core.tests.abstract.test_functional_history import HistoryEntriesCommon
class History(
HistoryEntriesCommon,
TestCase,
):
model = Team
history_model = TeamHistory
@classmethod
def setUpTestData(self):
super().setUpTestData()
self.field_name = 'team_name'
self.obj = self.model.objects.create(
organization = self.organization,
# name = self.field_value_original,
team_name = self.field_value_original
)
self.obj_delete = self.model.objects.create(
organization = self.organization,
name = self.field_value_delete,
)
self.call_the_banners()

View File

@ -1,56 +0,0 @@
from django.test import TestCase
from access.models.contact import Contact
from access.tests.unit.person.test_unit_person_history_api_v2 import (
PersonHistoryAPIInheritedCases
)
class ContactModelHistoryAPITestCases(
PersonHistoryAPIInheritedCases,
):
""" Model Histoy Test Cases
Test must be setup by creating object `kwargs_create_audit_object` with the
attributes required to create the object.
"""
audit_model = Contact
kwargs_create_audit_object: dict = {
'email': 'ipfunny@unit.test',
}
class ContactHistoryAPIInheritedCases(
ContactModelHistoryAPITestCases,
):
"""Sub-Entity Test Cases
Test Cases for Entity models that inherit from model Contact
"""
audit_model = None
kwargs_create_audit_object: dict = None
@classmethod
def setUpTestData(self):
self.kwargs_create_audit_object.update(
super().kwargs_create_audit_object
)
super().setUpTestData()
class ContactModelHistoryAPITest(
ContactModelHistoryAPITestCases,
TestCase,
):
pass

View File

@ -1,82 +0,0 @@
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from access.models.entity_history import Entity, EntityHistory
from core.tests.abstract.test_unit_model_history_api_v2 import PrimaryModelHistoryAPI
class ModelHistoryAPITestCases(
PrimaryModelHistoryAPI,
):
""" Model Histoy Test Cases
Test must be setup by creating object `kwargs_create_audit_object` with the
attributes required to create the object.
"""
audit_model = None
kwargs_create_audit_object: dict = {}
model = EntityHistory
@classmethod
def setUpTestData(self):
super().setUpTestData()
self.audit_object = self.audit_model.objects.create(
organization = self.organization,
entity_type = self.audit_model._meta.model_name,
**self.kwargs_create_audit_object
)
self.history_entry = self.model.objects.create(
organization = self.audit_object.organization,
action = self.model.Actions.ADD,
user = self.view_user,
before = {},
after = {},
content_type = ContentType.objects.get(
app_label = self.audit_object._meta.app_label,
model = self.audit_object._meta.model_name,
),
model = self.audit_object,
)
self.make_request()
class EntityModelHistoryAPIInheritedCases(
ModelHistoryAPITestCases,
):
audit_model = None
kwargs_create_audit_object: dict = None
@classmethod
def setUpTestData(self):
self.kwargs_create_audit_object.update(
super().kwargs_create_audit_object
)
super().setUpTestData()
class EntityModelHistoryAPITest(
ModelHistoryAPITestCases,
TestCase,
):
audit_model = Entity
kwargs_create_audit_object: dict = {}

View File

@ -1,40 +0,0 @@
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from core.tests.abstract.test_unit_model_history_api_v2 import PrimaryModelHistoryAPI
from access.models.organization_history import Tenant as Organization, OrganizationHistory
class ModelHistoryAPI(
PrimaryModelHistoryAPI,
TestCase,
):
audit_model = Organization
model = OrganizationHistory
@classmethod
def setUpTestData(self):
super().setUpTestData()
self.audit_object = self.organization
self.history_entry = self.model.objects.create(
organization = self.audit_object,
action = self.model.Actions.ADD,
user = self.view_user,
before = {},
after = {},
content_type = ContentType.objects.get(
app_label = self.audit_object._meta.app_label,
model = self.audit_object._meta.model_name,
),
model = self.audit_object,
)
self.make_request()

View File

@ -1,66 +0,0 @@
from django.test import TestCase
from access.models.person import Person
from access.tests.unit.entity.test_unit_entity_history_api_v2 import (
EntityModelHistoryAPIInheritedCases
)
class PersonModelHistoryAPITestCases(
EntityModelHistoryAPIInheritedCases,
):
""" Model Histoy Test Cases
Test must be setup by creating object `kwargs_create_audit_object` with the
attributes required to create the object.
"""
audit_model = Person
kwargs_create_audit_object: dict = {
'f_name': 'Ian',
'm_name': 'Peter',
'l_name': 'Funny',
'dob': '2025-04-08',
}
class PersonHistoryAPIInheritedCases(
PersonModelHistoryAPITestCases,
):
"""Sub-Entity Test Cases
Test Cases for Entity models that inherit from model Person
"""
audit_model = None
kwargs_create_audit_object: dict = None
@classmethod
def setUpTestData(self):
self.kwargs_create_audit_object.update(
super().kwargs_create_audit_object
)
super().setUpTestData()
class PersonModelHistoryAPITest(
PersonModelHistoryAPITestCases,
TestCase,
):
audit_model = Person
kwargs_create_audit_object: dict = {
'f_name': 'Ian',
'm_name': 'Peter',
'l_name': 'Funny',
'dob': '2025-04-08',
}

View File

@ -1,72 +0,0 @@
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from access.models.role_history import Role, RoleHistory
from core.tests.abstract.test_unit_model_history_api_v2 import PrimaryModelHistoryAPI
class ModelHistoryAPITestCases(
PrimaryModelHistoryAPI,
):
""" Model Histoy Test Cases
Test must be setup by creating object `kwargs_create_audit_object` with the
attributes required to create the object.
"""
audit_model = None
kwargs_create_audit_object: dict = None
model = None
@classmethod
def setUpTestData(self):
super().setUpTestData()
self.audit_object = self.audit_model.objects.create(
organization = self.organization,
**self.kwargs_create_audit_object
)
self.history_entry = self.model.objects.create(
organization = self.audit_object.organization,
action = self.model.Actions.ADD,
user = self.view_user,
before = {},
after = {},
content_type = ContentType.objects.get(
app_label = self.audit_object._meta.app_label,
model = self.audit_object._meta.model_name,
),
model = self.audit_object,
)
self.make_request()
class RoleHistoryAPITest(
ModelHistoryAPITestCases,
TestCase,
):
audit_model = Role
kwargs_create_audit_object: dict = {}
model = RoleHistory
@classmethod
def setUpTestData(self):
self.kwargs_create_audit_object = {
'name': 'a role'
}
super().setUpTestData()

View File

@ -1,43 +0,0 @@
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from core.tests.abstract.test_unit_model_history_api_v2 import PrimaryModelHistoryAPI
from access.models.team_history import Team, TeamHistory
class ModelHistoryAPI(
PrimaryModelHistoryAPI,
TestCase,
):
audit_model = Team
model = TeamHistory
@classmethod
def setUpTestData(self):
super().setUpTestData()
self.audit_object = self.audit_model.objects.create(
organization = self.organization,
name = 'one',
)
self.history_entry = self.model.objects.create(
organization = self.audit_object.organization,
action = self.model.Actions.ADD,
user = self.view_user,
before = {},
after = {},
content_type = ContentType.objects.get(
app_label = self.audit_object._meta.app_label,
model = self.audit_object._meta.model_name,
),
model = self.audit_object,
)
self.make_request()