mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 04:22:01 -06:00
Standardize base classes for view test cases
This commit is contained in:
parent
5d36d81ae1
commit
486f1a74ab
@ -321,7 +321,16 @@ class ManufacturerTestCase(ViewTestCases.OrganizationalObjectViewTestCase):
|
||||
)
|
||||
|
||||
|
||||
class DeviceTypeTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
# TODO: Change base class to PrimaryObjectViewTestCase
|
||||
class DeviceTypeTestCase(
|
||||
ViewTestCases.GetObjectViewTestCase,
|
||||
ViewTestCases.CreateObjectViewTestCase,
|
||||
ViewTestCases.EditObjectViewTestCase,
|
||||
ViewTestCases.DeleteObjectViewTestCase,
|
||||
ViewTestCases.ListObjectsViewTestCase,
|
||||
ViewTestCases.BulkEditObjectsViewTestCase,
|
||||
ViewTestCases.BulkDeleteObjectsViewTestCase
|
||||
):
|
||||
model = DeviceType
|
||||
|
||||
@classmethod
|
||||
@ -792,14 +801,15 @@ class RearPortTemplateTestCase(ViewTestCases.DeviceComponentTemplateViewTestCase
|
||||
}
|
||||
|
||||
|
||||
class DeviceBayTemplateTestCase(ViewTestCases.DeviceComponentTemplateViewTestCase):
|
||||
# TODO: Change base class to DeviceComponentTemplateViewTestCase
|
||||
class DeviceBayTemplateTestCase(
|
||||
ViewTestCases.EditObjectViewTestCase,
|
||||
ViewTestCases.DeleteObjectViewTestCase,
|
||||
ViewTestCases.BulkCreateObjectsViewTestCase,
|
||||
ViewTestCases.BulkDeleteObjectsViewTestCase
|
||||
):
|
||||
model = DeviceBayTemplate
|
||||
|
||||
# Disable inapplicable views
|
||||
test_bulk_edit_objects_without_permission = None
|
||||
test_bulk_edit_objects_with_model_permission = None
|
||||
test_bulk_edit_objects_with_object_permission = None
|
||||
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
manufacturer = Manufacturer.objects.create(name='Manufacturer 1', slug='manufacturer-1')
|
||||
@ -1439,14 +1449,18 @@ class InventoryItemTestCase(ViewTestCases.DeviceComponentViewTestCase):
|
||||
)
|
||||
|
||||
|
||||
class CableTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
# TODO: Change base class to PrimaryObjectViewTestCase
|
||||
class CableTestCase(
|
||||
ViewTestCases.GetObjectViewTestCase,
|
||||
ViewTestCases.EditObjectViewTestCase,
|
||||
ViewTestCases.DeleteObjectViewTestCase,
|
||||
ViewTestCases.ListObjectsViewTestCase,
|
||||
ViewTestCases.BulkImportObjectsViewTestCase,
|
||||
ViewTestCases.BulkEditObjectsViewTestCase,
|
||||
ViewTestCases.BulkDeleteObjectsViewTestCase
|
||||
):
|
||||
model = Cable
|
||||
|
||||
# TODO: Creation URL needs termination context
|
||||
test_create_object_without_permission = None
|
||||
test_create_object_with_model_permission = None
|
||||
test_create_object_with_object_permission = None
|
||||
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
|
||||
@ -1515,22 +1529,16 @@ class CableTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
}
|
||||
|
||||
|
||||
class VirtualChassisTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
# TODO: Change base class to PrimaryObjectViewTestCase
|
||||
class VirtualChassisTestCase(
|
||||
ViewTestCases.GetObjectViewTestCase,
|
||||
ViewTestCases.DeleteObjectViewTestCase,
|
||||
ViewTestCases.ListObjectsViewTestCase,
|
||||
ViewTestCases.BulkEditObjectsViewTestCase,
|
||||
ViewTestCases.BulkDeleteObjectsViewTestCase
|
||||
):
|
||||
model = VirtualChassis
|
||||
|
||||
# Disable inapplicable tests
|
||||
test_bulk_import_objects_without_permission = None
|
||||
test_bulk_import_objects_with_model_permission = None
|
||||
test_bulk_import_objects_with_object_permission = None
|
||||
|
||||
# TODO: Requires special form handling
|
||||
test_create_object_without_permission = None
|
||||
test_create_object_with_model_permission = None
|
||||
test_create_object_with_object_permission = None
|
||||
test_edit_object_without_permission = None
|
||||
test_edit_object_with_model_permission = None
|
||||
test_edit_object_with_object_permission = None
|
||||
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
|
||||
|
@ -10,17 +10,17 @@ from extras.models import ConfigContext, ObjectChange, Tag
|
||||
from utilities.testing import ViewTestCases, TestCase
|
||||
|
||||
|
||||
class TagTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
# TODO: Change base class to PrimaryObjectViewTestCase
|
||||
class TagTestCase(
|
||||
ViewTestCases.GetObjectViewTestCase,
|
||||
ViewTestCases.EditObjectViewTestCase,
|
||||
ViewTestCases.DeleteObjectViewTestCase,
|
||||
ViewTestCases.ListObjectsViewTestCase,
|
||||
ViewTestCases.BulkEditObjectsViewTestCase,
|
||||
ViewTestCases.BulkDeleteObjectsViewTestCase
|
||||
):
|
||||
model = Tag
|
||||
|
||||
# Disable inapplicable tests
|
||||
test_create_object_without_permission = None
|
||||
test_create_object_with_model_permission = None
|
||||
test_create_object_with_object_permission = None
|
||||
test_bulk_import_objects_without_permission = None
|
||||
test_bulk_import_objects_with_model_permission = None
|
||||
test_bulk_import_objects_with_object_permission = None
|
||||
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
|
||||
@ -42,22 +42,16 @@ class TagTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
}
|
||||
|
||||
|
||||
class ConfigContextTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
# TODO: Change base class to PrimaryObjectViewTestCase
|
||||
class ConfigContextTestCase(
|
||||
ViewTestCases.GetObjectViewTestCase,
|
||||
ViewTestCases.DeleteObjectViewTestCase,
|
||||
ViewTestCases.ListObjectsViewTestCase,
|
||||
ViewTestCases.BulkEditObjectsViewTestCase,
|
||||
ViewTestCases.BulkDeleteObjectsViewTestCase
|
||||
):
|
||||
model = ConfigContext
|
||||
|
||||
# Disable inapplicable tests
|
||||
test_bulk_import_objects_without_permission = None
|
||||
test_bulk_import_objects_with_model_permission = None
|
||||
test_bulk_import_objects_with_object_permission = None
|
||||
|
||||
# TODO: Resolve model discrepancies when creating/editing ConfigContexts
|
||||
test_create_object_without_permission = None
|
||||
test_create_object_with_model_permission = None
|
||||
test_create_object_with_object_permission = None
|
||||
test_edit_object_without_permission = None
|
||||
test_edit_object_with_model_permission = None
|
||||
test_edit_object_with_object_permission = None
|
||||
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
|
||||
|
@ -333,14 +333,18 @@ class VLANTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
}
|
||||
|
||||
|
||||
class ServiceTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
# TODO: Update base class to PrimaryObjectViewTestCase
|
||||
class ServiceTestCase(
|
||||
ViewTestCases.GetObjectViewTestCase,
|
||||
ViewTestCases.EditObjectViewTestCase,
|
||||
ViewTestCases.DeleteObjectViewTestCase,
|
||||
ViewTestCases.ListObjectsViewTestCase,
|
||||
ViewTestCases.BulkImportObjectsViewTestCase,
|
||||
ViewTestCases.BulkEditObjectsViewTestCase,
|
||||
ViewTestCases.BulkDeleteObjectsViewTestCase
|
||||
):
|
||||
model = Service
|
||||
|
||||
# TODO: Resolve URL for Service creation
|
||||
test_create_object_without_permission = None
|
||||
test_create_object_with_model_permission = None
|
||||
test_create_object_with_object_permission = None
|
||||
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
|
||||
|
@ -36,19 +36,16 @@ class SecretRoleTestCase(ViewTestCases.OrganizationalObjectViewTestCase):
|
||||
)
|
||||
|
||||
|
||||
class SecretTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
# TODO: Change base class to PrimaryObjectViewTestCase
|
||||
class SecretTestCase(
|
||||
ViewTestCases.GetObjectViewTestCase,
|
||||
ViewTestCases.DeleteObjectViewTestCase,
|
||||
ViewTestCases.ListObjectsViewTestCase,
|
||||
ViewTestCases.BulkEditObjectsViewTestCase,
|
||||
ViewTestCases.BulkDeleteObjectsViewTestCase
|
||||
):
|
||||
model = Secret
|
||||
|
||||
# Disable inapplicable tests
|
||||
test_create_object_without_permission = None
|
||||
test_create_object_with_model_permission = None
|
||||
test_create_object_with_object_permission = None
|
||||
|
||||
# TODO: Check permissions enforcement on secrets.views.secret_edit
|
||||
test_edit_object_without_permission = None
|
||||
test_edit_object_with_model_permission = None
|
||||
test_edit_object_with_object_permission = None
|
||||
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
|
||||
|
@ -185,21 +185,17 @@ class VirtualMachineTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
}
|
||||
|
||||
|
||||
# TODO: Update base class to DeviceComponentViewTestCase
|
||||
class InterfaceTestCase(
|
||||
ViewTestCases.GetObjectViewTestCase,
|
||||
ViewTestCases.DeviceComponentViewTestCase,
|
||||
ViewTestCases.EditObjectViewTestCase,
|
||||
ViewTestCases.DeleteObjectViewTestCase,
|
||||
ViewTestCases.BulkCreateObjectsViewTestCase,
|
||||
ViewTestCases.BulkEditObjectsViewTestCase,
|
||||
ViewTestCases.BulkDeleteObjectsViewTestCase,
|
||||
):
|
||||
model = Interface
|
||||
|
||||
# Disable inapplicable tests
|
||||
test_list_objects_anonymous = None
|
||||
test_list_objects_without_permission = None
|
||||
test_list_objects_with_model_permission = None
|
||||
test_list_objects_with_object_permission = None
|
||||
test_bulk_import_objects_without_permission = None
|
||||
test_bulk_import_objects_with_model_permission = None
|
||||
test_bulk_import_objects_with_object_permission = None
|
||||
|
||||
def _get_base_url(self):
|
||||
# Interface belongs to the DCIM app, so we have to override the base URL
|
||||
return 'virtualization:interface_{}'
|
||||
|
Loading…
Reference in New Issue
Block a user