1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Establish standard test cases for all models

This commit is contained in:
Jeremy Stretch
2020-02-12 12:33:27 -05:00
parent e4b910fe87
commit 3b1128f8f3
8 changed files with 253 additions and 390 deletions

View File

@@ -5,10 +5,10 @@ from netaddr import IPNetwork
from dcim.models import Device, DeviceRole, DeviceType, Manufacturer, Site
from ipam.choices import *
from ipam.models import Aggregate, IPAddress, Prefix, RIR, Role, Service, VLAN, VLANGroup, VRF
from utilities.testing import StandardTestCases
from utilities.testing import ViewTestCases
class VRFTestCase(StandardTestCases.Views):
class VRFTestCase(ViewTestCases.PrimaryObjectViewTestCase):
model = VRF
@classmethod
@@ -43,14 +43,9 @@ class VRFTestCase(StandardTestCases.Views):
}
class RIRTestCase(StandardTestCases.Views):
class RIRTestCase(ViewTestCases.OrganizationalObjectViewTestCase):
model = RIR
# Disable inapplicable tests
test_get_object = None
test_delete_object = None
test_bulk_edit_objects = None
@classmethod
def setUpTestData(cls):
@@ -74,7 +69,7 @@ class RIRTestCase(StandardTestCases.Views):
)
class AggregateTestCase(StandardTestCases.Views):
class AggregateTestCase(ViewTestCases.PrimaryObjectViewTestCase):
model = Aggregate
@classmethod
@@ -115,14 +110,9 @@ class AggregateTestCase(StandardTestCases.Views):
}
class RoleTestCase(StandardTestCases.Views):
class RoleTestCase(ViewTestCases.OrganizationalObjectViewTestCase):
model = Role
# Disable inapplicable tests
test_get_object = None
test_delete_object = None
test_bulk_edit_objects = None
@classmethod
def setUpTestData(cls):
@@ -147,7 +137,7 @@ class RoleTestCase(StandardTestCases.Views):
)
class PrefixTestCase(StandardTestCases.Views):
class PrefixTestCase(ViewTestCases.PrimaryObjectViewTestCase):
model = Prefix
@classmethod
@@ -207,7 +197,7 @@ class PrefixTestCase(StandardTestCases.Views):
}
class IPAddressTestCase(StandardTestCases.Views):
class IPAddressTestCase(ViewTestCases.PrimaryObjectViewTestCase):
model = IPAddress
@classmethod
@@ -254,14 +244,9 @@ class IPAddressTestCase(StandardTestCases.Views):
}
class VLANGroupTestCase(StandardTestCases.Views):
class VLANGroupTestCase(ViewTestCases.OrganizationalObjectViewTestCase):
model = VLANGroup
# Disable inapplicable tests
test_get_object = None
test_delete_object = None
test_bulk_edit_objects = None
@classmethod
def setUpTestData(cls):
@@ -287,7 +272,7 @@ class VLANGroupTestCase(StandardTestCases.Views):
)
class VLANTestCase(StandardTestCases.Views):
class VLANTestCase(ViewTestCases.PrimaryObjectViewTestCase):
model = VLAN
@classmethod
@@ -346,7 +331,7 @@ class VLANTestCase(StandardTestCases.Views):
}
class ServiceTestCase(StandardTestCases.Views):
class ServiceTestCase(ViewTestCases.PrimaryObjectViewTestCase):
model = Service
# Disable inapplicable tests