diff --git a/app/itam/tests/unit/device/test_unit_device_model.py b/app/itam/tests/unit/device/test_unit_device_model.py index c0c90b85..bd85dddb 100644 --- a/app/itam/tests/unit/device/test_unit_device_model.py +++ b/app/itam/tests/unit/device/test_unit_device_model.py @@ -17,7 +17,7 @@ class DeviceModelTestCases( @property def parameterized_class_attributes(self): - + return { 'model_tag': { 'type': str, @@ -28,12 +28,12 @@ class DeviceModelTestCases( @property def parameterized_model_fields(self): - + return { 'name': { 'blank': False, 'default': models.fields.NOT_PROVIDED, - 'field_type': models.IntegerField, + 'field_type': models.CharField, 'length': 50, 'null': False, 'unique': True, @@ -48,7 +48,7 @@ class DeviceModelTestCases( 'uuid': { 'blank': True, 'default': models.fields.NOT_PROVIDED, - 'field_type': models.CharField, + 'field_type': models.UUIDField, 'length': 50, 'null': True, 'unique': True, diff --git a/app/itam/tests/unit/device/test_unit_device_viewset.py b/app/itam/tests/unit/device/test_unit_device_viewset.py index 969dd082..a96cc7d3 100644 --- a/app/itam/tests/unit/device/test_unit_device_viewset.py +++ b/app/itam/tests/unit/device/test_unit_device_viewset.py @@ -1,43 +1,90 @@ import pytest -from django.test import Client, TestCase - -from rest_framework.reverse import reverse - from api.tests.unit.test_unit_common_viewset import ModelViewSetInheritedCases -from itam.viewsets.device import ViewSet +from itam.viewsets.device import ( + Device, + ViewSet, +) -@pytest.mark.skip(reason = 'see #895, tests being refactored') -class DeviceViewsetList( +@pytest.mark.model_device +class ViewsetTestCases( ModelViewSetInheritedCases, - TestCase, ): - viewset = ViewSet - - route_name = 'v2:_api_device' - - @classmethod - def setUpTestData(self): - """Setup Test - - 1. make list request - """ - - super().setUpTestData() + @pytest.fixture( scope = 'function' ) + def viewset(self): + return ViewSet - client = Client() - - url = reverse( - self.route_name + '-list', - kwargs = self.kwargs - ) + @property + def parameterized_class_attributes(self): + return { + '_model_documentation': { + 'type': type(None), + }, + 'back_url': { + 'type': type(None), + }, + 'documentation': { + 'type': type(None), + 'value': None + }, + 'filterset_fields': { + 'value': [ + 'name', + 'serial_number', + 'organization', + 'uuid', + 'cluster_device', + 'cluster_node' + ] + }, + 'model': { + 'value': Device + }, + 'model_documentation': { + 'type': type(None), + }, + 'queryset': { + 'type': type(None), + }, + 'serializer_class': { + 'type': type(None), + }, + 'search_fields': { + 'value': [ + 'name', + 'serial_number', + 'uuid' + ] + }, + 'view_description': { + 'value': 'Physical Devices' + }, + 'view_name': { + 'type': type(None), + }, + 'view_serializer_name': { + 'type': type(None), + } + } - client.force_login(self.view_user) - self.http_options_response_list = client.options(url) + +class DeviceViewsetInheritedCases( + ViewsetTestCases, +): + pass + + + +@pytest.mark.module_itam +class DeviceViewsetPyTest( + ViewsetTestCases, +): + + pass