test(access): Add Tenant Unit serializer test suite
ref: #807 #730 #790
This commit is contained in:
@ -17,3 +17,9 @@ def model_kwargs(request, kwargs_tenant):
|
||||
|
||||
if hasattr(request.cls, 'kwargs_create_item'):
|
||||
del request.cls.kwargs_create_item
|
||||
|
||||
|
||||
@pytest.fixture( scope = 'class')
|
||||
def model_serializer(serializer_tenant):
|
||||
|
||||
yield serializer_tenant
|
||||
|
20
app/access/tests/unit/tenant/test_unit_tenant_serializer.py
Normal file
20
app/access/tests/unit/tenant/test_unit_tenant_serializer.py
Normal file
@ -0,0 +1,20 @@
|
||||
import pytest
|
||||
|
||||
from api.tests.unit.test_unit_serializer import (
|
||||
SerializerTestCases
|
||||
)
|
||||
|
||||
|
||||
class TenantSerializerTestCases(
|
||||
SerializerTestCases
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@pytest.mark.model_tenant
|
||||
@pytest.mark.module_access
|
||||
class TenantSerializerPyTest(
|
||||
TenantSerializerTestCases
|
||||
):
|
||||
pass
|
1
app/tests/fixtures/__init__.py
vendored
1
app/tests/fixtures/__init__.py
vendored
@ -136,6 +136,7 @@ from .model_teamuser import (
|
||||
from .model_tenant import (
|
||||
kwargs_tenant,
|
||||
model_tenant,
|
||||
serializer_tenant,
|
||||
)
|
||||
|
||||
from .model_tenancyabstract import (
|
||||
|
15
app/tests/fixtures/model_tenant.py
vendored
15
app/tests/fixtures/model_tenant.py
vendored
@ -2,6 +2,11 @@ import datetime
|
||||
import pytest
|
||||
|
||||
from access.models.tenant import Tenant
|
||||
from access.serializers.organization import (
|
||||
TenantBaseSerializer,
|
||||
TenantModelSerializer,
|
||||
TenantViewSerializer
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture( scope = 'class')
|
||||
@ -32,3 +37,13 @@ def kwargs_tenant( django_db_blocker, model_user ):
|
||||
with django_db_blocker.unblock():
|
||||
|
||||
user.delete()
|
||||
|
||||
|
||||
@pytest.fixture( scope = 'class')
|
||||
def serializer_tenant():
|
||||
|
||||
yield {
|
||||
'base': TenantBaseSerializer,
|
||||
'model': TenantModelSerializer,
|
||||
'view': TenantViewSerializer
|
||||
}
|
||||
|
Reference in New Issue
Block a user