refactor(settings): API Metadata Functional Test Suite re-written to Pytest for model ExternalLink
ref: #942 #940
This commit is contained in:
25
app/settings/tests/functional/external_links/conftest.py
Normal file
25
app/settings/tests/functional/external_links/conftest.py
Normal file
@ -0,0 +1,25 @@
|
||||
import pytest
|
||||
|
||||
|
||||
|
||||
@pytest.fixture( scope = 'class')
|
||||
def model(model_externallink):
|
||||
|
||||
yield model_externallink
|
||||
|
||||
|
||||
@pytest.fixture( scope = 'class', autouse = True)
|
||||
def model_kwargs(request, kwargs_externallink):
|
||||
|
||||
request.cls.kwargs_create_item = kwargs_externallink.copy()
|
||||
|
||||
yield kwargs_externallink.copy()
|
||||
|
||||
if hasattr(request.cls, 'kwargs_create_item'):
|
||||
del request.cls.kwargs_create_item
|
||||
|
||||
|
||||
@pytest.fixture( scope = 'class')
|
||||
def model_serializer(serializer_externallink):
|
||||
|
||||
yield serializer_externallink
|
@ -1,11 +1,7 @@
|
||||
import django
|
||||
import pytest
|
||||
import unittest
|
||||
import requests
|
||||
|
||||
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.contrib.auth.models import AnonymousUser, Permission
|
||||
from django.contrib.auth.models import Permission
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.test import TestCase
|
||||
|
||||
@ -13,8 +9,6 @@ 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 APIPermissions
|
||||
from api.tests.abstract.api_serializer_viewset import SerializersTestCases
|
||||
from api.tests.abstract.test_metadata_functional import MetadataAttributesFunctional
|
||||
|
||||
from settings.models.external_link import ExternalLink
|
||||
@ -23,6 +17,7 @@ User = django.contrib.auth.get_user_model()
|
||||
|
||||
|
||||
|
||||
@pytest.mark.model_externallink
|
||||
class ViewSetBase:
|
||||
|
||||
model = ExternalLink
|
||||
@ -199,28 +194,7 @@ class ViewSetBase:
|
||||
|
||||
|
||||
|
||||
class ExternalLinkPermissionsAPI(ViewSetBase, APIPermissions, TestCase):
|
||||
|
||||
|
||||
def test_returned_data_from_user_and_global_organizations_only(self):
|
||||
"""Check items returned
|
||||
|
||||
This test case is a over-ride of a test case with the same name.
|
||||
This model is not a tenancy model making this test not-applicable.
|
||||
|
||||
Items returned from the query Must be from the users organization and
|
||||
global ONLY!
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
|
||||
class ExternalLinkViewSet(ViewSetBase, SerializersTestCases, TestCase):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@pytest.mark.module_settings
|
||||
class ExternalLinkMetadata(
|
||||
ViewSetBase,
|
||||
MetadataAttributesFunctional,
|
@ -16,7 +16,7 @@ from centurion.tests.abstract.mock_view import MockView
|
||||
|
||||
|
||||
@pytest.mark.model_appsettings
|
||||
class ProjectSerializerTestCases(
|
||||
class AppSettingsSerializerTestCases(
|
||||
SerializerTestCases
|
||||
):
|
||||
|
||||
@ -96,15 +96,15 @@ class ProjectSerializerTestCases(
|
||||
|
||||
|
||||
|
||||
class ProjectSerializerInheritedCases(
|
||||
ProjectSerializerTestCases
|
||||
class AppSettingsSerializerInheritedCases(
|
||||
AppSettingsSerializerTestCases
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@pytest.mark.module_settings
|
||||
class ProjectSerializerPyTest(
|
||||
ProjectSerializerTestCases
|
||||
class AppSettingsSerializerPyTest(
|
||||
AppSettingsSerializerTestCases
|
||||
):
|
||||
pass
|
Reference in New Issue
Block a user