From 0bc3f420f016cd1ad037b769c4922db3d1f28978 Mon Sep 17 00:00:00 2001 From: Jon Date: Fri, 7 Feb 2025 21:46:54 +0930 Subject: [PATCH] test: remove old notes model tests ref: #389 #526 --- .../test_config_groups_notes_viewset.py | 75 ------------------ .../device/test_device_notes_viewset.py | 79 ------------------- .../test_operating_system_notes_viewset.py | 79 ------------------- .../software/test_software_notes_viewset.py | 79 ------------------- .../service/test_service_notes_viewset.py | 74 ----------------- 5 files changed, 386 deletions(-) delete mode 100644 app/config_management/tests/functional/config_groups/test_config_groups_notes_viewset.py delete mode 100644 app/itam/tests/functional/device/test_device_notes_viewset.py delete mode 100644 app/itam/tests/functional/operating_system/test_operating_system_notes_viewset.py delete mode 100644 app/itam/tests/functional/software/test_software_notes_viewset.py delete mode 100644 app/itim/tests/functional/service/test_service_notes_viewset.py diff --git a/app/config_management/tests/functional/config_groups/test_config_groups_notes_viewset.py b/app/config_management/tests/functional/config_groups/test_config_groups_notes_viewset.py deleted file mode 100644 index 9cb01cfa..00000000 --- a/app/config_management/tests/functional/config_groups/test_config_groups_notes_viewset.py +++ /dev/null @@ -1,75 +0,0 @@ -import pytest - -from django.test import TestCase - -from core.tests.abstract.test_notes_viewset import NoteViewSetCommon - -from core.models.notes import Notes - -from config_management.models.groups import ConfigGroups - - - -class NotePermissionsAPI( - NoteViewSetCommon, - TestCase, -): - - app_namespace = 'API' - - url_name = '_api_v2_config_group_note' - - - @classmethod - def setUpTestData(self): - """Setup Test - - 1. Create an organization for user and item - . create an organization that is different to item - 2. Create a team - 3. create teams with each permission: view, add, change, delete - 4. create a user per team - """ - - super().setUpTestData() - - - - self.note_item = ConfigGroups.objects.create( - organization = self.organization, - name = 'history-device' - ) - - self.item = Notes.objects.create( - organization = self.organization, - note = 'a note', - usercreated = self.view_user, - config_group = self.note_item - ) - - self.other_org_item = Notes.objects.create( - organization = self.different_organization, - note = 'b note', - usercreated = self.view_user, - config_group = self.note_item - ) - - - self.url_kwargs = {'config_group_id': self.note_item.id} - - self.url_view_kwargs = {'config_group_id': self.note_item.id, 'pk': self.item.pk } - - self.add_data = {'note': 'a note added', 'organization': self.organization.id} - - - - def test_returned_data_from_user_and_global_organizations_only(self): - """Check items returned - - This test case is a over-ride of a test case with the same name. - This model is not a tenancy model making this test not-applicable. - - Items returned from the query Must be from the users organization and - global ONLY! - """ - pass diff --git a/app/itam/tests/functional/device/test_device_notes_viewset.py b/app/itam/tests/functional/device/test_device_notes_viewset.py deleted file mode 100644 index 79f1041f..00000000 --- a/app/itam/tests/functional/device/test_device_notes_viewset.py +++ /dev/null @@ -1,79 +0,0 @@ -import pytest - -from django.test import TestCase - -from core.tests.abstract.test_notes_viewset import NoteViewSetCommon - -from core.models.notes import Notes - -from itam.models.device import Device - - - -class DeviceNotePermissionsAPI( - NoteViewSetCommon, - TestCase, -): - - app_namespace = 'API' - - url_name = '_api_v2_device_note' - - - @classmethod - def setUpTestData(self): - """Setup Test - - 1. Create an organization for user and item - . create an organization that is different to item - 2. Create a team - 3. create teams with each permission: view, add, change, delete - 4. create a user per team - """ - - super().setUpTestData() - - - - self.note_item = Device.objects.create( - organization = self.organization, - name = 'history-device' - ) - - self.note_item_b = Device.objects.create( - organization = self.different_organization, - name = 'history-device-b' - ) - - self.item = Notes.objects.create( - organization = self.organization, - note = 'a note', - usercreated = self.view_user, - device = self.note_item - ) - - self.other_org_item = Notes.objects.create( - organization = self.different_organization, - note = 'b note', - usercreated = self.view_user, - device = self.note_item_b - ) - - - self.url_kwargs = {'device_id': self.note_item.id} - - self.url_view_kwargs = {'device_id': self.note_item.id, 'pk': self.item.pk } - - self.add_data = {'note': 'a note added', 'organization': self.organization.id} - - - def test_returned_data_from_user_and_global_organizations_only(self): - """Check items returned - - This test case is a over-ride of a test case with the same name. - This model is not a tenancy model making this test not-applicable. - - Items returned from the query Must be from the users organization and - global ONLY! - """ - pass \ No newline at end of file diff --git a/app/itam/tests/functional/operating_system/test_operating_system_notes_viewset.py b/app/itam/tests/functional/operating_system/test_operating_system_notes_viewset.py deleted file mode 100644 index 8f6f0df7..00000000 --- a/app/itam/tests/functional/operating_system/test_operating_system_notes_viewset.py +++ /dev/null @@ -1,79 +0,0 @@ -import pytest - -from django.test import TestCase - -from core.tests.abstract.test_notes_viewset import NoteViewSetCommon - -from core.models.notes import Notes - -from itam.models.operating_system import OperatingSystem - - - -class OperatingSystemNotePermissionsAPI( - NoteViewSetCommon, - TestCase, -): - - app_namespace = 'API' - - url_name = '_api_v2_operating_system_note' - - - @classmethod - def setUpTestData(self): - """Setup Test - - 1. Create an organization for user and item - . create an organization that is different to item - 2. Create a team - 3. create teams with each permission: view, add, change, delete - 4. create a user per team - """ - - super().setUpTestData() - - - - self.note_item = OperatingSystem.objects.create( - organization = self.organization, - name = 'history-device' - ) - - self.note_item_b = OperatingSystem.objects.create( - organization = self.organization, - name = 'history-device-b' - ) - - self.item = Notes.objects.create( - organization = self.organization, - note = 'a note', - usercreated = self.view_user, - operatingsystem = self.note_item - ) - - self.other_org_item = Notes.objects.create( - organization = self.different_organization, - note = 'b note', - usercreated = self.view_user, - operatingsystem = self.note_item_b - ) - - - self.url_kwargs = {'operating_system_id': self.note_item.id} - - self.url_view_kwargs = {'operating_system_id': self.note_item.id, 'pk': self.item.pk } - - self.add_data = {'note': 'a note added', 'organization': self.organization.id} - - - def test_returned_data_from_user_and_global_organizations_only(self): - """Check items returned - - This test case is a over-ride of a test case with the same name. - This model is not a tenancy model making this test not-applicable. - - Items returned from the query Must be from the users organization and - global ONLY! - """ - pass \ No newline at end of file diff --git a/app/itam/tests/functional/software/test_software_notes_viewset.py b/app/itam/tests/functional/software/test_software_notes_viewset.py deleted file mode 100644 index 510f2cc2..00000000 --- a/app/itam/tests/functional/software/test_software_notes_viewset.py +++ /dev/null @@ -1,79 +0,0 @@ -import pytest - -from django.test import TestCase - -from core.tests.abstract.test_notes_viewset import NoteViewSetCommon - -from core.models.notes import Notes - -from itam.models.software import Software - - - -class SoftwareNotePermissionsAPI( - NoteViewSetCommon, - TestCase, -): - - app_namespace = 'API' - - url_name = '_api_v2_software_note' - - - @classmethod - def setUpTestData(self): - """Setup Test - - 1. Create an organization for user and item - . create an organization that is different to item - 2. Create a team - 3. create teams with each permission: view, add, change, delete - 4. create a user per team - """ - - super().setUpTestData() - - - - self.note_item = Software.objects.create( - organization = self.organization, - name = 'history-device' - ) - - self.note_item_b = Software.objects.create( - organization = self.different_organization, - name = 'history-device-b' - ) - - self.item = Notes.objects.create( - organization = self.organization, - note = 'a note', - usercreated = self.view_user, - software = self.note_item - ) - - self.other_org_item = Notes.objects.create( - organization = self.different_organization, - note = 'b note', - usercreated = self.view_user, - software = self.note_item_b - ) - - - self.url_kwargs = {'software_id': self.note_item.id} - - self.url_view_kwargs = {'software_id': self.note_item.id, 'pk': self.item.pk } - - self.add_data = {'note': 'a note added', 'organization': self.organization.id} - - - def test_returned_data_from_user_and_global_organizations_only(self): - """Check items returned - - This test case is a over-ride of a test case with the same name. - This model is not a tenancy model making this test not-applicable. - - Items returned from the query Must be from the users organization and - global ONLY! - """ - pass \ No newline at end of file diff --git a/app/itim/tests/functional/service/test_service_notes_viewset.py b/app/itim/tests/functional/service/test_service_notes_viewset.py deleted file mode 100644 index c4ca9683..00000000 --- a/app/itim/tests/functional/service/test_service_notes_viewset.py +++ /dev/null @@ -1,74 +0,0 @@ -import pytest - -from django.test import TestCase - -from core.tests.abstract.test_notes_viewset import NoteViewSetCommon - -from core.models.notes import Notes - -from itim.models.services import Service - - - -class ServiceNotePermissionsAPI( - NoteViewSetCommon, - TestCase, -): - - app_namespace = 'API' - - url_name = '_api_v2_service_note' - - - @classmethod - def setUpTestData(self): - """Setup Test - - 1. Create an organization for user and item - . create an organization that is different to item - 2. Create a team - 3. create teams with each permission: view, add, change, delete - 4. create a user per team - """ - - super().setUpTestData() - - - - self.note_item = Service.objects.create( - organization = self.organization, - name = 'history-device' - ) - - self.item = Notes.objects.create( - organization = self.organization, - note = 'a note', - usercreated = self.view_user, - service = self.note_item - ) - - self.other_org_item = Notes.objects.create( - organization = self.different_organization, - note = 'b note', - usercreated = self.view_user, - service = self.note_item - ) - - - self.url_kwargs = {'service_id': self.note_item.id} - - self.url_view_kwargs = {'service_id': self.note_item.id, 'pk': self.item.pk } - - self.add_data = {'note': 'a note added', 'organization': self.organization.id} - - - def test_returned_data_from_user_and_global_organizations_only(self): - """Check items returned - - This test case is a over-ride of a test case with the same name. - This model is not a tenancy model making this test not-applicable. - - Items returned from the query Must be from the users organization and - global ONLY! - """ - pass \ No newline at end of file