test(access): Refactor Contact model API Fields render test Suite to PyTest

ref: #883 #879
This commit is contained in:
2025-07-24 17:11:35 +09:30
parent cbaaefa87d
commit 6e65802932
3 changed files with 51 additions and 44 deletions

View File

@ -22,3 +22,13 @@ def create_serializer():
yield ModelSerializer
@pytest.fixture( scope = 'class')
def model_kwargs(request, kwargs_contact):
request.cls.kwargs_create_item = kwargs_contact.copy()
yield kwargs_contact.copy()
if hasattr(request.cls, 'kwargs_create_item'):
del request.cls.kwargs_create_item

View File

@ -0,0 +1,41 @@
import pytest
from access.tests.functional.person.test_functional_person_api_fields import (
PersonAPIInheritedCases
)
@pytest.mark.model_contact
class ContactAPITestCases(
PersonAPIInheritedCases,
):
property
def parameterized_api_fields(self):
return {
'email': {
'expected': str
},
'directory': {
'expected': bool
}
}
class ContactAPIInheritedCases(
ContactAPITestCases,
):
pass
@pytest.mark.module_access
class ContactAPIPyTest(
ContactAPITestCases,
):
pass

View File

@ -1,44 +0,0 @@
import pytest
from access.tests.unit.person.test_unit_person_api_fields import (
PersonAPIInheritedCases
)
@pytest.mark.model_contact
class ContactAPITestCases(
PersonAPIInheritedCases,
):
parameterized_test_data = {
'email': {
'expected': str
},
'directory': {
'expected': bool
}
}
kwargs_create_item: dict = {
'email': 'ipfunny@unit.test',
}
class ContactAPIInheritedCases(
ContactAPITestCases,
):
kwargs_create_item: dict = None
model = None
@pytest.mark.module_access
class ContactAPIPyTest(
ContactAPITestCases,
):
pass