From 82bfacbab33cc9b1250948cb9adc2d4f91004dc8 Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 5 Jun 2025 16:17:29 +0930 Subject: [PATCH] chore: disable api field notess and history tests tests being re-written ref: #788 #759 #768 --- app/access/serializers/team_user.py | 2 +- .../tests/unit/role/test_unit_role_api_v2.py | 30 +++++----- app/api/serializers/auth_token.py | 2 +- app/api/tests/abstract/api_fields.py | 60 +++++++++---------- .../serializers/config_group_software.py | 2 +- .../manufacturer/test_manufacturer_api_v2.py | 20 +++---- .../test_unit_feature_flag_api_v2.py | 20 +++---- ...nit_software_enable_feature_flag_api_v2.py | 20 +++---- .../serializers/device_operating_system.py | 2 +- app/itam/serializers/device_software.py | 2 +- .../tests/unit/device/test_device_api_v2.py | 40 ++++++------- .../unit/software/test_software_api_v2.py | 50 ++++++++-------- 12 files changed, 125 insertions(+), 125 deletions(-) diff --git a/app/access/serializers/team_user.py b/app/access/serializers/team_user.py index 7c860d05..cac07fdc 100644 --- a/app/access/serializers/team_user.py +++ b/app/access/serializers/team_user.py @@ -53,7 +53,7 @@ class TeamUserModelSerializer( get_url = super().get_url( item = item ) - del get_url['history'] + # del get_url['history'] del get_url['knowledge_base'] diff --git a/app/access/tests/unit/role/test_unit_role_api_v2.py b/app/access/tests/unit/role/test_unit_role_api_v2.py index 42096a2f..8efcfd21 100644 --- a/app/access/tests/unit/role/test_unit_role_api_v2.py +++ b/app/access/tests/unit/role/test_unit_role_api_v2.py @@ -98,31 +98,31 @@ class APITestCases( - def test_api_field_exists_url_history(self): - """ Test for existance of API Field + # def test_api_field_exists_url_history(self): + # """ Test for existance of API Field - _urls.history field must exist - """ + # _urls.history field must exist + # """ - assert 'history' in self.api_data['_urls'] + # assert 'history' in self.api_data['_urls'] - def test_api_field_type_url_history(self): - """ Test for type for API Field + # def test_api_field_type_url_history(self): + # """ Test for type for API Field - _urls.history field must be str - """ + # _urls.history field must be str + # """ - assert type(self.api_data['_urls']['history']) is str + # assert type(self.api_data['_urls']['history']) is str - def test_api_field_type_url_history_value(self): - """ Test for url value + # def test_api_field_type_url_history_value(self): + # """ Test for url value - _urls.history field must use the endpoint for entity model - """ + # _urls.history field must use the endpoint for entity model + # """ - assert str(self.api_data['_urls']['history']).endswith('/access/role/' + str(self.item.pk) + '/history') + # assert str(self.api_data['_urls']['history']).endswith('/access/role/' + str(self.item.pk) + '/history') diff --git a/app/api/serializers/auth_token.py b/app/api/serializers/auth_token.py index 3ec3b9c4..98782bd1 100644 --- a/app/api/serializers/auth_token.py +++ b/app/api/serializers/auth_token.py @@ -52,7 +52,7 @@ class AuthTokenModelSerializer( get_url = super().get_url( item = item ) - del get_url['history'] + # del get_url['history'] del get_url['knowledge_base'] diff --git a/app/api/tests/abstract/api_fields.py b/app/api/tests/abstract/api_fields.py index bd030a40..303b8cad 100644 --- a/app/api/tests/abstract/api_fields.py +++ b/app/api/tests/abstract/api_fields.py @@ -96,56 +96,56 @@ class APICommonFields: - def test_api_field_exists_urls_notes(self): - """ Test for existance of API Field + # def test_api_field_exists_urls_notes(self): + # """ Test for existance of API Field - _urls.notes field must exist - """ + # _urls.notes field must exist + # """ - obj = getattr(self.item, 'get_url_kwargs_notes', None) + # obj = getattr(self.item, 'get_url_kwargs_notes', None) - if callable(obj): + # if callable(obj): - obj = obj() + # obj = obj() - if( - not str(self.model._meta.model_name).lower().endswith('notes') - and obj is not FeatureNotUsed - ): + # if( + # not str(self.model._meta.model_name).lower().endswith('notes') + # and obj is not FeatureNotUsed + # ): - assert 'notes' in self.api_data['_urls'] + # assert 'notes' in self.api_data['_urls'] - else: + # else: - print('Test is n/a') + # print('Test is n/a') - assert True + # assert True - def test_api_field_type_urls_notes(self): - """ Test for type for API Field + # def test_api_field_type_urls_notes(self): + # """ Test for type for API Field - _urls._self field must be str - """ + # _urls._self field must be str + # """ - obj = getattr(self.item, 'get_url_kwargs_notes', None) + # obj = getattr(self.item, 'get_url_kwargs_notes', None) - if callable(obj): + # if callable(obj): - obj = obj() + # obj = obj() - if( - not str(self.model._meta.model_name).lower().endswith('notes') - and obj is not FeatureNotUsed - ): + # if( + # not str(self.model._meta.model_name).lower().endswith('notes') + # and obj is not FeatureNotUsed + # ): - assert type(self.api_data['_urls']['notes']) is str + # assert type(self.api_data['_urls']['notes']) is str - else: + # else: - print('Test is n/a') + # print('Test is n/a') - assert True + # assert True diff --git a/app/config_management/serializers/config_group_software.py b/app/config_management/serializers/config_group_software.py index 19d9af14..25881561 100644 --- a/app/config_management/serializers/config_group_software.py +++ b/app/config_management/serializers/config_group_software.py @@ -61,7 +61,7 @@ class ConfigGroupSoftwareModelSerializer( get_url = super().get_url( item = item ) - del get_url['history'] + # del get_url['history'] del get_url['knowledge_base'] get_url.update({ diff --git a/app/core/tests/unit/manufacturer/test_manufacturer_api_v2.py b/app/core/tests/unit/manufacturer/test_manufacturer_api_v2.py index 8d5c48ab..0f5eff02 100644 --- a/app/core/tests/unit/manufacturer/test_manufacturer_api_v2.py +++ b/app/core/tests/unit/manufacturer/test_manufacturer_api_v2.py @@ -97,19 +97,19 @@ class ManufacturerAPI( - def test_api_field_exists_url_history(self): - """ Test for existance of API Field + # def test_api_field_exists_url_history(self): + # """ Test for existance of API Field - _urls.history field must exist - """ + # _urls.history field must exist + # """ - assert 'history' in self.api_data['_urls'] + # assert 'history' in self.api_data['_urls'] - def test_api_field_type_url_history(self): - """ Test for type for API Field + # def test_api_field_type_url_history(self): + # """ Test for type for API Field - _urls.history field must be str - """ + # _urls.history field must be str + # """ - assert type(self.api_data['_urls']['history']) is str + # assert type(self.api_data['_urls']['history']) is str diff --git a/app/devops/tests/unit/feature_flag/test_unit_feature_flag_api_v2.py b/app/devops/tests/unit/feature_flag/test_unit_feature_flag_api_v2.py index 5100de8d..f70fe3da 100644 --- a/app/devops/tests/unit/feature_flag/test_unit_feature_flag_api_v2.py +++ b/app/devops/tests/unit/feature_flag/test_unit_feature_flag_api_v2.py @@ -110,22 +110,22 @@ class API( - def test_api_field_exists_url_history(self): - """ Test for existance of API Field + # def test_api_field_exists_url_history(self): + # """ Test for existance of API Field - _urls.history field must exist - """ + # _urls.history field must exist + # """ - assert 'history' in self.api_data['_urls'] + # assert 'history' in self.api_data['_urls'] - def test_api_field_type_url_history(self): - """ Test for type for API Field + # def test_api_field_type_url_history(self): + # """ Test for type for API Field - _urls.history field must be str - """ + # _urls.history field must be str + # """ - assert type(self.api_data['_urls']['history']) is str + # assert type(self.api_data['_urls']['history']) is str def test_api_field_exists_description(self): diff --git a/app/devops/tests/unit/software_enable_feature_flag/test_unit_software_enable_feature_flag_api_v2.py b/app/devops/tests/unit/software_enable_feature_flag/test_unit_software_enable_feature_flag_api_v2.py index 10f9f6aa..9c7288b0 100644 --- a/app/devops/tests/unit/software_enable_feature_flag/test_unit_software_enable_feature_flag_api_v2.py +++ b/app/devops/tests/unit/software_enable_feature_flag/test_unit_software_enable_feature_flag_api_v2.py @@ -108,22 +108,22 @@ class API( - def test_api_field_exists_url_history(self): - """ Test for existance of API Field + # def test_api_field_exists_url_history(self): + # """ Test for existance of API Field - _urls.history field must exist - """ + # _urls.history field must exist + # """ - assert 'history' not in self.api_data['_urls'] + # assert 'history' not in self.api_data['_urls'] - def test_api_field_type_url_history(self): - """ Test for type for API Field + # def test_api_field_type_url_history(self): + # """ Test for type for API Field - _urls.history field must be str - """ + # _urls.history field must be str + # """ - assert 'history' not in self.api_data['_urls'] + # assert 'history' not in self.api_data['_urls'] def test_api_field_exists_description(self): diff --git a/app/itam/serializers/device_operating_system.py b/app/itam/serializers/device_operating_system.py index cb887e23..ef989722 100644 --- a/app/itam/serializers/device_operating_system.py +++ b/app/itam/serializers/device_operating_system.py @@ -60,7 +60,7 @@ class DeviceOperatingSystemModelSerializer( get_url = super().get_url( item = item ) - del get_url['history'] + # del get_url['history'] del get_url['knowledge_base'] diff --git a/app/itam/serializers/device_software.py b/app/itam/serializers/device_software.py index 68bd0555..4157f43c 100644 --- a/app/itam/serializers/device_software.py +++ b/app/itam/serializers/device_software.py @@ -61,7 +61,7 @@ class DeviceSoftwareModelSerializer( get_url = super().get_url( item = item ) - del get_url['history'] + # del get_url['history'] del get_url['knowledge_base'] diff --git a/app/itam/tests/unit/device/test_device_api_v2.py b/app/itam/tests/unit/device/test_device_api_v2.py index 9b066bfc..d73a684b 100644 --- a/app/itam/tests/unit/device/test_device_api_v2.py +++ b/app/itam/tests/unit/device/test_device_api_v2.py @@ -495,41 +495,41 @@ class DeviceAPI( - def test_api_field_exists_urls_history(self): - """ Test for existance of API Field + # def test_api_field_exists_urls_history(self): + # """ Test for existance of API Field - _urls.history field must exist - """ + # _urls.history field must exist + # """ - assert 'history' in self.api_data['_urls'] + # assert 'history' in self.api_data['_urls'] - def test_api_field_type_urls_history(self): - """ Test for type for API Field + # def test_api_field_type_urls_history(self): + # """ Test for type for API Field - _urls.history field must be str - """ + # _urls.history field must be str + # """ - assert type(self.api_data['_urls']['history']) is str + # assert type(self.api_data['_urls']['history']) is str - def test_api_field_exists_urls_notes(self): - """ Test for existance of API Field + # def test_api_field_exists_urls_notes(self): + # """ Test for existance of API Field - _urls.notes field must exist - """ + # _urls.notes field must exist + # """ - assert 'notes' in self.api_data['_urls'] + # assert 'notes' in self.api_data['_urls'] - def test_api_field_type_urls_notes(self): - """ Test for type for API Field + # def test_api_field_type_urls_notes(self): + # """ Test for type for API Field - _urls.notes field must be str - """ + # _urls.notes field must be str + # """ - assert type(self.api_data['_urls']['notes']) is str + # assert type(self.api_data['_urls']['notes']) is str diff --git a/app/itam/tests/unit/software/test_software_api_v2.py b/app/itam/tests/unit/software/test_software_api_v2.py index 3e7b0b7e..d696b75f 100644 --- a/app/itam/tests/unit/software/test_software_api_v2.py +++ b/app/itam/tests/unit/software/test_software_api_v2.py @@ -259,41 +259,41 @@ class SoftwareAPI( - def test_api_field_exists_urls_history(self): - """ Test for existance of API Field + # def test_api_field_exists_urls_history(self): + # """ Test for existance of API Field - _urls.history field must exist - """ + # _urls.history field must exist + # """ - assert 'history' in self.api_data['_urls'] + # assert 'history' in self.api_data['_urls'] - def test_api_field_type_urls_history(self): - """ Test for type for API Field + # def test_api_field_type_urls_history(self): + # """ Test for type for API Field - _urls.history field must be str - """ + # _urls.history field must be str + # """ - assert type(self.api_data['_urls']['history']) is str + # assert type(self.api_data['_urls']['history']) is str - def test_api_field_exists_urls_notes(self): - """ Test for existance of API Field + # def test_api_field_exists_urls_notes(self): + # """ Test for existance of API Field - _urls.notes field must exist - """ + # _urls.notes field must exist + # """ - assert 'notes' in self.api_data['_urls'] + # assert 'notes' in self.api_data['_urls'] - def test_api_field_type_urls_notes(self): - """ Test for type for API Field + # def test_api_field_type_urls_notes(self): + # """ Test for type for API Field - _urls.notes field must be str - """ + # _urls.notes field must be str + # """ - assert type(self.api_data['_urls']['notes']) is str + # assert type(self.api_data['_urls']['notes']) is str @@ -306,13 +306,13 @@ class SoftwareAPI( assert 'version' in self.api_data['_urls'] - def test_api_field_type_urls_notes(self): - """ Test for type for API Field + # def test_api_field_type_urls_notes(self): + # """ Test for type for API Field - _urls.version field must be str - """ + # _urls.version field must be str + # """ - assert type(self.api_data['_urls']['version']) is str + # assert type(self.api_data['_urls']['version']) is str