test(access): Add Serializer unit test suit for model Contact
ref: #893 #879
This commit is contained in:
@ -16,3 +16,9 @@ def model_kwargs(request, kwargs_contact):
|
||||
|
||||
if hasattr(request.cls, 'kwargs_create_item'):
|
||||
del request.cls.kwargs_create_item
|
||||
|
||||
|
||||
@pytest.fixture( scope = 'class')
|
||||
def model_serializer(serializer_contact):
|
||||
|
||||
yield serializer_contact
|
||||
|
@ -0,0 +1,28 @@
|
||||
import pytest
|
||||
|
||||
from access.tests.unit.person.test_unit_person_serializer import (
|
||||
PersonSerializerInheritedCases
|
||||
)
|
||||
|
||||
|
||||
|
||||
@pytest.mark.model_contact
|
||||
class ContactSerializerTestCases(
|
||||
PersonSerializerInheritedCases
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
class ContactSerializerInheritedCases(
|
||||
ContactSerializerTestCases
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@pytest.mark.module_access
|
||||
class ContactSerializerPyTest(
|
||||
ContactSerializerTestCases
|
||||
):
|
||||
pass
|
1
app/tests/fixtures/__init__.py
vendored
1
app/tests/fixtures/__init__.py
vendored
@ -92,6 +92,7 @@ from .model_configgroupsoftware import (
|
||||
from .model_contact import (
|
||||
kwargs_contact,
|
||||
model_contact,
|
||||
serializer_contact,
|
||||
)
|
||||
|
||||
from .model_contenttype import (
|
||||
|
15
app/tests/fixtures/model_contact.py
vendored
15
app/tests/fixtures/model_contact.py
vendored
@ -2,6 +2,11 @@ import datetime
|
||||
import pytest
|
||||
|
||||
from access.models.contact import Contact
|
||||
from access.serializers.entity_contact import (
|
||||
BaseSerializer,
|
||||
ModelSerializer,
|
||||
ViewSerializer
|
||||
)
|
||||
|
||||
|
||||
|
||||
@ -25,3 +30,13 @@ def kwargs_contact( kwargs_person ):
|
||||
}
|
||||
|
||||
yield kwargs.copy()
|
||||
|
||||
|
||||
@pytest.fixture( scope = 'class')
|
||||
def serializer_contact():
|
||||
|
||||
yield {
|
||||
'base': BaseSerializer,
|
||||
'model': ModelSerializer,
|
||||
'view': ViewSerializer
|
||||
}
|
||||
|
Reference in New Issue
Block a user