refactor(itam): API Fields render Test Suite re-written to Pytest for model DeviceType
ref: #920 #919
This commit is contained in:
25
app/itam/tests/functional/device_type/conftest.py
Normal file
25
app/itam/tests/functional/device_type/conftest.py
Normal file
@ -0,0 +1,25 @@
|
||||
import pytest
|
||||
|
||||
|
||||
|
||||
@pytest.fixture( scope = 'class')
|
||||
def model(model_devicetype):
|
||||
|
||||
yield model_devicetype
|
||||
|
||||
|
||||
@pytest.fixture( scope = 'class', autouse = True)
|
||||
def model_kwargs(request, kwargs_devicetype):
|
||||
|
||||
request.cls.kwargs_create_item = kwargs_devicetype.copy()
|
||||
|
||||
yield kwargs_devicetype.copy()
|
||||
|
||||
if hasattr(request.cls, 'kwargs_create_item'):
|
||||
del request.cls.kwargs_create_item
|
||||
|
||||
|
||||
@pytest.fixture( scope = 'class')
|
||||
def model_serializer(serializer_devicetype):
|
||||
|
||||
yield serializer_devicetype
|
@ -0,0 +1,42 @@
|
||||
import pytest
|
||||
|
||||
from rest_framework.relations import Hyperlink
|
||||
|
||||
from api.tests.functional.test_functional_api_fields import (
|
||||
APIFieldsInheritedCases,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@pytest.mark.model_devicetype
|
||||
class DeviceTypeAPITestCases(
|
||||
APIFieldsInheritedCases,
|
||||
):
|
||||
|
||||
@property
|
||||
def parameterized_api_fields(self):
|
||||
|
||||
return {
|
||||
'name': {
|
||||
'expected': str
|
||||
},
|
||||
'modified': {
|
||||
'expected': str
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
class DeviceTypeAPIInheritedCases(
|
||||
DeviceTypeAPITestCases,
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@pytest.mark.module_itam
|
||||
class DeviceTypeAPIPyTest(
|
||||
DeviceTypeAPITestCases,
|
||||
):
|
||||
|
||||
pass
|
Reference in New Issue
Block a user