From 4b1548afa8430e65d0d9ace40067a3c6b0df95e0 Mon Sep 17 00:00:00 2001 From: Jon Date: Sat, 2 Aug 2025 10:22:38 +0930 Subject: [PATCH] refactor(itam): API Metadata Functional Test Suite re-written to Pytest for model OperatingSystem ref: #925 #922 --- .../functional/operating_system/conftest.py | 25 +++++++++++++++++++ ...t_functional_operating_system_metadata.py} | 22 ---------------- 2 files changed, 25 insertions(+), 22 deletions(-) create mode 100644 app/itam/tests/functional/operating_system/conftest.py rename app/itam/tests/functional/operating_system/{test_operating_system_viewset.py => test_functional_operating_system_metadata.py} (94%) diff --git a/app/itam/tests/functional/operating_system/conftest.py b/app/itam/tests/functional/operating_system/conftest.py new file mode 100644 index 00000000..da7cd06f --- /dev/null +++ b/app/itam/tests/functional/operating_system/conftest.py @@ -0,0 +1,25 @@ +import pytest + + + +@pytest.fixture( scope = 'class') +def model(model_operatingsystem): + + yield model_operatingsystem + + +@pytest.fixture( scope = 'class', autouse = True) +def model_kwargs(request, kwargs_operatingsystem): + + request.cls.kwargs_create_item = kwargs_operatingsystem.copy() + + yield kwargs_operatingsystem.copy() + + if hasattr(request.cls, 'kwargs_create_item'): + del request.cls.kwargs_create_item + + +@pytest.fixture( scope = 'class') +def model_serializer(serializer_device): + + yield serializer_device diff --git a/app/itam/tests/functional/operating_system/test_operating_system_viewset.py b/app/itam/tests/functional/operating_system/test_functional_operating_system_metadata.py similarity index 94% rename from app/itam/tests/functional/operating_system/test_operating_system_viewset.py rename to app/itam/tests/functional/operating_system/test_functional_operating_system_metadata.py index 18cff95f..1f4c135f 100644 --- a/app/itam/tests/functional/operating_system/test_operating_system_viewset.py +++ b/app/itam/tests/functional/operating_system/test_functional_operating_system_metadata.py @@ -9,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, MetaDataNavigationEntriesFunctional from itam.models.operating_system import OperatingSystem @@ -218,26 +216,6 @@ class ViewSetBase: -class OperatingSystemPermissionsAPI( - ViewSetBase, - APIPermissions, - TestCase, -): - - pass - - - -class OperatingSystemViewSet( - ViewSetBase, - SerializersTestCases, - TestCase, -): - - pass - - - class OperatingSystemMetadata( ViewSetBase, MetadataAttributesFunctional,