refactor(devops): API Metadata Functional Test Suite re-written to Pytest for model SoftwareEnableFeatureFlag
ref: #946 #945
This commit is contained in:
@ -126,7 +126,7 @@ class FeatureFlagAPIInheritedCases(
|
||||
|
||||
|
||||
|
||||
@pytest.mark.module_assistance
|
||||
@pytest.mark.module_devops
|
||||
class FeatureFlagAPIPyTest(
|
||||
FeatureFlagAPITestCases,
|
||||
):
|
||||
|
@ -21,7 +21,7 @@ class FeatureFlagModelInheritedCases(
|
||||
|
||||
|
||||
|
||||
@pytest.mark.module_assistance
|
||||
@pytest.mark.module_devops
|
||||
class FeatureFlagModelPyTest(
|
||||
FeatureFlagModelTestCases,
|
||||
):
|
||||
|
@ -0,0 +1,25 @@
|
||||
import pytest
|
||||
|
||||
|
||||
|
||||
@pytest.fixture( scope = 'class')
|
||||
def model(model_softwareenablefeatureflag):
|
||||
|
||||
yield model_softwareenablefeatureflag
|
||||
|
||||
|
||||
@pytest.fixture( scope = 'class', autouse = True)
|
||||
def model_kwargs(request, kwargs_softwareenablefeatureflag):
|
||||
|
||||
request.cls.kwargs_create_item = kwargs_softwareenablefeatureflag.copy()
|
||||
|
||||
yield kwargs_softwareenablefeatureflag.copy()
|
||||
|
||||
if hasattr(request.cls, 'kwargs_create_item'):
|
||||
del request.cls.kwargs_create_item
|
||||
|
||||
|
||||
@pytest.fixture( scope = 'class')
|
||||
def model_serializer(serializer_softwareenablefeatureflag):
|
||||
|
||||
yield serializer_softwareenablefeatureflag
|
@ -4,19 +4,15 @@ from django.contrib.auth.models import (
|
||||
Permission,
|
||||
)
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.test import Client, TestCase
|
||||
from django.test import TestCase
|
||||
|
||||
from django.shortcuts import reverse
|
||||
|
||||
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 devops.models.feature_flag import FeatureFlag
|
||||
from devops.models.software_enable_feature_flag import SoftwareEnableFeatureFlag
|
||||
|
||||
from itam.models.software import Software
|
||||
@ -263,49 +259,6 @@ class ViewSetBase:
|
||||
|
||||
|
||||
|
||||
class PermissionsAPI(
|
||||
ViewSetBase,
|
||||
APIPermissions,
|
||||
TestCase,
|
||||
):
|
||||
|
||||
pass
|
||||
|
||||
def test_add_has_permission(self):
|
||||
""" Check correct permission for add
|
||||
|
||||
This test cases is a duplicate of a test with the same name. Required
|
||||
as the kwargs are different from normal
|
||||
|
||||
Attempt to add as user with permission
|
||||
"""
|
||||
|
||||
client = Client()
|
||||
# if self.url_kwargs:
|
||||
|
||||
url = reverse(self.app_namespace + ':' + self.url_name + '-list', kwargs = {
|
||||
'software_id': self.software_add.id,
|
||||
}
|
||||
)
|
||||
|
||||
client.force_login(self.add_user)
|
||||
response = client.post(url, data=self.add_data)
|
||||
|
||||
assert response.status_code == 201
|
||||
|
||||
|
||||
|
||||
|
||||
class ViewSet(
|
||||
ViewSetBase,
|
||||
SerializersTestCases,
|
||||
TestCase
|
||||
):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
|
||||
class Metadata(
|
||||
ViewSetBase,
|
||||
MetadataAttributesFunctional,
|
@ -250,7 +250,7 @@ class FeatureFlagSerializerInheritedCases(
|
||||
|
||||
|
||||
|
||||
@pytest.mark.module_assistance
|
||||
@pytest.mark.module_devops
|
||||
class FeatureFlagSerializerPyTest(
|
||||
FeatureFlagSerializerTestCases
|
||||
):
|
||||
|
Reference in New Issue
Block a user