refactor(settings): API Metadata Functional Test Suite re-written to Pytest for model AppSettings
ref: #942 #939
This commit is contained in:
25
app/settings/tests/functional/app_settings/conftest.py
Normal file
25
app/settings/tests/functional/app_settings/conftest.py
Normal file
@ -0,0 +1,25 @@
|
||||
import pytest
|
||||
|
||||
|
||||
|
||||
@pytest.fixture( scope = 'class')
|
||||
def model(model_appsettings):
|
||||
|
||||
yield model_appsettings
|
||||
|
||||
|
||||
@pytest.fixture( scope = 'class', autouse = True)
|
||||
def model_kwargs(request, kwargs_appsettings):
|
||||
|
||||
request.cls.kwargs_create_item = kwargs_appsettings.copy()
|
||||
|
||||
yield kwargs_appsettings.copy()
|
||||
|
||||
if hasattr(request.cls, 'kwargs_create_item'):
|
||||
del request.cls.kwargs_create_item
|
||||
|
||||
|
||||
@pytest.fixture( scope = 'class')
|
||||
def model_serializer(serializer_appsettings):
|
||||
|
||||
yield serializer_appsettings
|
@ -3,22 +3,12 @@ import pytest
|
||||
|
||||
from django.contrib.auth.models import Permission
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.shortcuts import reverse
|
||||
from django.test import Client, TestCase
|
||||
from django import urls
|
||||
from django.test import TestCase
|
||||
|
||||
from access.models.tenant import Tenant as Organization
|
||||
from access.models.team import Team
|
||||
from access.models.team_user import TeamUsers
|
||||
|
||||
from api.tests.abstract.api_permissions_viewset import (
|
||||
APIPermissionChange,
|
||||
APIPermissionView
|
||||
)
|
||||
from api.tests.abstract.api_serializer_viewset import (
|
||||
SerializerChange,
|
||||
SerializerView,
|
||||
)
|
||||
from api.tests.abstract.test_metadata_functional import (
|
||||
MetadataAttributesFunctionalBase,
|
||||
MetadataAttributesFunctionalEndpoint
|
||||
@ -30,6 +20,7 @@ User = django.contrib.auth.get_user_model()
|
||||
|
||||
|
||||
|
||||
@pytest.mark.model_appsettings
|
||||
class ViewSetBase:
|
||||
|
||||
model = AppSettings
|
||||
@ -193,17 +184,8 @@ class ViewSetBase:
|
||||
)
|
||||
|
||||
|
||||
class AppSettingsViewSet(
|
||||
ViewSetBase,
|
||||
SerializerChange,
|
||||
SerializerView,
|
||||
TestCase,
|
||||
):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@pytest.mark.module_settings
|
||||
class AppSettingsMetadata(
|
||||
ViewSetBase,
|
||||
MetadataAttributesFunctionalEndpoint,
|
Reference in New Issue
Block a user