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

Consolidate GraphQLTestCase into APIViewTestCase

This commit is contained in:
jeremystretch
2021-06-30 10:07:33 -04:00
parent 728b3bac67
commit e6091ee0c9
8 changed files with 82 additions and 87 deletions

View File

@ -15,7 +15,7 @@ class AppTest(APITestCase):
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
class ProviderTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class ProviderTest(APIViewTestCases.APIViewTestCase):
model = Provider model = Provider
brief_fields = ['circuit_count', 'display', 'id', 'name', 'slug', 'url'] brief_fields = ['circuit_count', 'display', 'id', 'name', 'slug', 'url']
create_data = [ create_data = [
@ -47,7 +47,7 @@ class ProviderTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTes
Provider.objects.bulk_create(providers) Provider.objects.bulk_create(providers)
class CircuitTypeTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class CircuitTypeTest(APIViewTestCases.APIViewTestCase):
model = CircuitType model = CircuitType
brief_fields = ['circuit_count', 'display', 'id', 'name', 'slug', 'url'] brief_fields = ['circuit_count', 'display', 'id', 'name', 'slug', 'url']
create_data = ( create_data = (
@ -79,7 +79,7 @@ class CircuitTypeTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIView
CircuitType.objects.bulk_create(circuit_types) CircuitType.objects.bulk_create(circuit_types)
class CircuitTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class CircuitTest(APIViewTestCases.APIViewTestCase):
model = Circuit model = Circuit
brief_fields = ['cid', 'display', 'id', 'url'] brief_fields = ['cid', 'display', 'id', 'url']
bulk_update_data = { bulk_update_data = {
@ -127,7 +127,7 @@ class CircuitTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTest
] ]
class CircuitTerminationTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class CircuitTerminationTest(APIViewTestCases.APIViewTestCase):
model = CircuitTermination model = CircuitTermination
brief_fields = ['_occupied', 'cable', 'circuit', 'display', 'id', 'term_side', 'url'] brief_fields = ['_occupied', 'cable', 'circuit', 'display', 'id', 'term_side', 'url']
@ -180,7 +180,7 @@ class CircuitTerminationTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.
} }
class ProviderNetworkTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class ProviderNetworkTest(APIViewTestCases.APIViewTestCase):
model = ProviderNetwork model = ProviderNetwork
brief_fields = ['display', 'id', 'name', 'url'] brief_fields = ['display', 'id', 'name', 'url']

View File

@ -57,7 +57,7 @@ class Mixins:
self.assertEqual(segment1[2]['name'], peer_obj.name) self.assertEqual(segment1[2]['name'], peer_obj.name)
class RegionTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class RegionTest(APIViewTestCases.APIViewTestCase):
model = Region model = Region
brief_fields = ['_depth', 'display', 'id', 'name', 'site_count', 'slug', 'url'] brief_fields = ['_depth', 'display', 'id', 'name', 'site_count', 'slug', 'url']
create_data = [ create_data = [
@ -86,7 +86,7 @@ class RegionTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestC
Region.objects.create(name='Region 3', slug='region-3') Region.objects.create(name='Region 3', slug='region-3')
class SiteGroupTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class SiteGroupTest(APIViewTestCases.APIViewTestCase):
model = SiteGroup model = SiteGroup
brief_fields = ['_depth', 'display', 'id', 'name', 'site_count', 'slug', 'url'] brief_fields = ['_depth', 'display', 'id', 'name', 'site_count', 'slug', 'url']
create_data = [ create_data = [
@ -115,7 +115,7 @@ class SiteGroupTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTe
SiteGroup.objects.create(name='Site Group 3', slug='site-group-3') SiteGroup.objects.create(name='Site Group 3', slug='site-group-3')
class SiteTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class SiteTest(APIViewTestCases.APIViewTestCase):
model = Site model = Site
brief_fields = ['display', 'id', 'name', 'slug', 'url'] brief_fields = ['display', 'id', 'name', 'slug', 'url']
bulk_update_data = { bulk_update_data = {
@ -167,7 +167,7 @@ class SiteTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCas
] ]
class LocationTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class LocationTest(APIViewTestCases.APIViewTestCase):
model = Location model = Location
brief_fields = ['_depth', 'display', 'id', 'name', 'rack_count', 'slug', 'url'] brief_fields = ['_depth', 'display', 'id', 'name', 'rack_count', 'slug', 'url']
bulk_update_data = { bulk_update_data = {
@ -214,7 +214,7 @@ class LocationTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTes
] ]
class RackRoleTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class RackRoleTest(APIViewTestCases.APIViewTestCase):
model = RackRole model = RackRole
brief_fields = ['display', 'id', 'name', 'rack_count', 'slug', 'url'] brief_fields = ['display', 'id', 'name', 'rack_count', 'slug', 'url']
create_data = [ create_data = [
@ -249,7 +249,7 @@ class RackRoleTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTes
RackRole.objects.bulk_create(rack_roles) RackRole.objects.bulk_create(rack_roles)
class RackTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class RackTest(APIViewTestCases.APIViewTestCase):
model = Rack model = Rack
brief_fields = ['device_count', 'display', 'id', 'name', 'url'] brief_fields = ['device_count', 'display', 'id', 'name', 'url']
bulk_update_data = { bulk_update_data = {
@ -337,7 +337,7 @@ class RackTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCas
self.assertEqual(response.get('Content-Type'), 'image/svg+xml') self.assertEqual(response.get('Content-Type'), 'image/svg+xml')
class RackReservationTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class RackReservationTest(APIViewTestCases.APIViewTestCase):
model = RackReservation model = RackReservation
brief_fields = ['display', 'id', 'units', 'url', 'user'] brief_fields = ['display', 'id', 'units', 'url', 'user']
bulk_update_data = { bulk_update_data = {
@ -384,7 +384,7 @@ class RackReservationTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.API
] ]
class ManufacturerTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class ManufacturerTest(APIViewTestCases.APIViewTestCase):
model = Manufacturer model = Manufacturer
brief_fields = ['devicetype_count', 'display', 'id', 'name', 'slug', 'url'] brief_fields = ['devicetype_count', 'display', 'id', 'name', 'slug', 'url']
create_data = [ create_data = [
@ -416,7 +416,7 @@ class ManufacturerTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIVie
Manufacturer.objects.bulk_create(manufacturers) Manufacturer.objects.bulk_create(manufacturers)
class DeviceTypeTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class DeviceTypeTest(APIViewTestCases.APIViewTestCase):
model = DeviceType model = DeviceType
brief_fields = ['device_count', 'display', 'id', 'manufacturer', 'model', 'slug', 'url'] brief_fields = ['device_count', 'display', 'id', 'manufacturer', 'model', 'slug', 'url']
bulk_update_data = { bulk_update_data = {
@ -458,7 +458,7 @@ class DeviceTypeTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewT
] ]
class ConsolePortTemplateTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class ConsolePortTemplateTest(APIViewTestCases.APIViewTestCase):
model = ConsolePortTemplate model = ConsolePortTemplate
brief_fields = ['display', 'id', 'name', 'url'] brief_fields = ['display', 'id', 'name', 'url']
bulk_update_data = { bulk_update_data = {
@ -495,7 +495,7 @@ class ConsolePortTemplateTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases
] ]
class ConsoleServerPortTemplateTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class ConsoleServerPortTemplateTest(APIViewTestCases.APIViewTestCase):
model = ConsoleServerPortTemplate model = ConsoleServerPortTemplate
brief_fields = ['display', 'id', 'name', 'url'] brief_fields = ['display', 'id', 'name', 'url']
bulk_update_data = { bulk_update_data = {
@ -532,7 +532,7 @@ class ConsoleServerPortTemplateTest(APIViewTestCases.GraphQLTestCase, APIViewTes
] ]
class PowerPortTemplateTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class PowerPortTemplateTest(APIViewTestCases.APIViewTestCase):
model = PowerPortTemplate model = PowerPortTemplate
brief_fields = ['display', 'id', 'name', 'url'] brief_fields = ['display', 'id', 'name', 'url']
bulk_update_data = { bulk_update_data = {
@ -569,7 +569,7 @@ class PowerPortTemplateTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.A
] ]
class PowerOutletTemplateTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class PowerOutletTemplateTest(APIViewTestCases.APIViewTestCase):
model = PowerOutletTemplate model = PowerOutletTemplate
brief_fields = ['display', 'id', 'name', 'url'] brief_fields = ['display', 'id', 'name', 'url']
bulk_update_data = { bulk_update_data = {
@ -606,7 +606,7 @@ class PowerOutletTemplateTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases
] ]
class InterfaceTemplateTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class InterfaceTemplateTest(APIViewTestCases.APIViewTestCase):
model = InterfaceTemplate model = InterfaceTemplate
brief_fields = ['display', 'id', 'name', 'url'] brief_fields = ['display', 'id', 'name', 'url']
bulk_update_data = { bulk_update_data = {
@ -646,7 +646,7 @@ class InterfaceTemplateTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.A
] ]
class FrontPortTemplateTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class FrontPortTemplateTest(APIViewTestCases.APIViewTestCase):
model = FrontPortTemplate model = FrontPortTemplate
brief_fields = ['display', 'id', 'name', 'url'] brief_fields = ['display', 'id', 'name', 'url']
bulk_update_data = { bulk_update_data = {
@ -717,7 +717,7 @@ class FrontPortTemplateTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.A
] ]
class RearPortTemplateTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class RearPortTemplateTest(APIViewTestCases.APIViewTestCase):
model = RearPortTemplate model = RearPortTemplate
brief_fields = ['display', 'id', 'name', 'url'] brief_fields = ['display', 'id', 'name', 'url']
bulk_update_data = { bulk_update_data = {
@ -757,7 +757,7 @@ class RearPortTemplateTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.AP
] ]
class DeviceBayTemplateTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class DeviceBayTemplateTest(APIViewTestCases.APIViewTestCase):
model = DeviceBayTemplate model = DeviceBayTemplate
brief_fields = ['display', 'id', 'name', 'url'] brief_fields = ['display', 'id', 'name', 'url']
bulk_update_data = { bulk_update_data = {
@ -797,7 +797,7 @@ class DeviceBayTemplateTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.A
] ]
class DeviceRoleTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class DeviceRoleTest(APIViewTestCases.APIViewTestCase):
model = DeviceRole model = DeviceRole
brief_fields = ['device_count', 'display', 'id', 'name', 'slug', 'url', 'virtualmachine_count'] brief_fields = ['device_count', 'display', 'id', 'name', 'slug', 'url', 'virtualmachine_count']
create_data = [ create_data = [
@ -832,7 +832,7 @@ class DeviceRoleTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewT
DeviceRole.objects.bulk_create(device_roles) DeviceRole.objects.bulk_create(device_roles)
class PlatformTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class PlatformTest(APIViewTestCases.APIViewTestCase):
model = Platform model = Platform
brief_fields = ['device_count', 'display', 'id', 'name', 'slug', 'url', 'virtualmachine_count'] brief_fields = ['device_count', 'display', 'id', 'name', 'slug', 'url', 'virtualmachine_count']
create_data = [ create_data = [
@ -864,7 +864,7 @@ class PlatformTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTes
Platform.objects.bulk_create(platforms) Platform.objects.bulk_create(platforms)
class DeviceTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class DeviceTest(APIViewTestCases.APIViewTestCase):
model = Device model = Device
brief_fields = ['display', 'id', 'name', 'url'] brief_fields = ['display', 'id', 'name', 'url']
bulk_update_data = { bulk_update_data = {
@ -1005,11 +1005,7 @@ class DeviceTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestC
self.assertHttpStatus(response, status.HTTP_400_BAD_REQUEST) self.assertHttpStatus(response, status.HTTP_400_BAD_REQUEST)
class ConsolePortTest( class ConsolePortTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIViewTestCase):
Mixins.ComponentTraceMixin,
APIViewTestCases.GraphQLTestCase,
APIViewTestCases.APIViewTestCase
):
model = ConsolePort model = ConsolePort
brief_fields = ['_occupied', 'cable', 'device', 'display', 'id', 'name', 'url'] brief_fields = ['_occupied', 'cable', 'device', 'display', 'id', 'name', 'url']
bulk_update_data = { bulk_update_data = {
@ -1048,11 +1044,7 @@ class ConsolePortTest(
] ]
class ConsoleServerPortTest( class ConsoleServerPortTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIViewTestCase):
Mixins.ComponentTraceMixin,
APIViewTestCases.GraphQLTestCase,
APIViewTestCases.APIViewTestCase
):
model = ConsoleServerPort model = ConsoleServerPort
brief_fields = ['_occupied', 'cable', 'device', 'display', 'id', 'name', 'url'] brief_fields = ['_occupied', 'cable', 'device', 'display', 'id', 'name', 'url']
bulk_update_data = { bulk_update_data = {
@ -1091,11 +1083,7 @@ class ConsoleServerPortTest(
] ]
class PowerPortTest( class PowerPortTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIViewTestCase):
Mixins.ComponentTraceMixin,
APIViewTestCases.GraphQLTestCase,
APIViewTestCases.APIViewTestCase
):
model = PowerPort model = PowerPort
brief_fields = ['_occupied', 'cable', 'device', 'display', 'id', 'name', 'url'] brief_fields = ['_occupied', 'cable', 'device', 'display', 'id', 'name', 'url']
bulk_update_data = { bulk_update_data = {
@ -1134,11 +1122,7 @@ class PowerPortTest(
] ]
class PowerOutletTest( class PowerOutletTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIViewTestCase):
Mixins.ComponentTraceMixin,
APIViewTestCases.GraphQLTestCase,
APIViewTestCases.APIViewTestCase
):
model = PowerOutlet model = PowerOutlet
brief_fields = ['_occupied', 'cable', 'device', 'display', 'id', 'name', 'url'] brief_fields = ['_occupied', 'cable', 'device', 'display', 'id', 'name', 'url']
bulk_update_data = { bulk_update_data = {
@ -1177,11 +1161,7 @@ class PowerOutletTest(
] ]
class InterfaceTest( class InterfaceTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIViewTestCase):
Mixins.ComponentTraceMixin,
APIViewTestCases.GraphQLTestCase,
APIViewTestCases.APIViewTestCase
):
model = Interface model = Interface
brief_fields = ['_occupied', 'cable', 'device', 'display', 'id', 'name', 'url'] brief_fields = ['_occupied', 'cable', 'device', 'display', 'id', 'name', 'url']
bulk_update_data = { bulk_update_data = {
@ -1239,7 +1219,7 @@ class InterfaceTest(
] ]
class FrontPortTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class FrontPortTest(APIViewTestCases.APIViewTestCase):
model = FrontPort model = FrontPort
brief_fields = ['_occupied', 'cable', 'device', 'display', 'id', 'name', 'url'] brief_fields = ['_occupied', 'cable', 'device', 'display', 'id', 'name', 'url']
bulk_update_data = { bulk_update_data = {
@ -1297,7 +1277,7 @@ class FrontPortTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTe
] ]
class RearPortTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class RearPortTest(APIViewTestCases.APIViewTestCase):
model = RearPort model = RearPort
brief_fields = ['_occupied', 'cable', 'device', 'display', 'id', 'name', 'url'] brief_fields = ['_occupied', 'cable', 'device', 'display', 'id', 'name', 'url']
bulk_update_data = { bulk_update_data = {
@ -1339,7 +1319,7 @@ class RearPortTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTes
] ]
class DeviceBayTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class DeviceBayTest(APIViewTestCases.APIViewTestCase):
model = DeviceBay model = DeviceBay
brief_fields = ['device', 'display', 'id', 'name', 'url'] brief_fields = ['device', 'display', 'id', 'name', 'url']
bulk_update_data = { bulk_update_data = {
@ -1402,7 +1382,7 @@ class DeviceBayTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTe
] ]
class InventoryItemTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class InventoryItemTest(APIViewTestCases.APIViewTestCase):
model = InventoryItem model = InventoryItem
brief_fields = ['_depth', 'device', 'display', 'id', 'name', 'url'] brief_fields = ['_depth', 'device', 'display', 'id', 'name', 'url']
bulk_update_data = { bulk_update_data = {
@ -1440,7 +1420,7 @@ class InventoryItemTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIVi
] ]
class CableTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class CableTest(APIViewTestCases.APIViewTestCase):
model = Cable model = Cable
brief_fields = ['display', 'id', 'label', 'url'] brief_fields = ['display', 'id', 'label', 'url']
bulk_update_data = { bulk_update_data = {
@ -1545,7 +1525,7 @@ class ConnectedDeviceTest(APITestCase):
self.assertEqual(response.data['name'], self.device1.name) self.assertEqual(response.data['name'], self.device1.name)
class VirtualChassisTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class VirtualChassisTest(APIViewTestCases.APIViewTestCase):
model = VirtualChassis model = VirtualChassis
brief_fields = ['id', 'master', 'member_count', 'name', 'url'] brief_fields = ['id', 'master', 'member_count', 'name', 'url']
@ -1625,7 +1605,7 @@ class VirtualChassisTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIV
} }
class PowerPanelTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class PowerPanelTest(APIViewTestCases.APIViewTestCase):
model = PowerPanel model = PowerPanel
brief_fields = ['display', 'id', 'name', 'powerfeed_count', 'url'] brief_fields = ['display', 'id', 'name', 'powerfeed_count', 'url']
@ -1674,7 +1654,7 @@ class PowerPanelTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewT
} }
class PowerFeedTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class PowerFeedTest(APIViewTestCases.APIViewTestCase):
model = PowerFeed model = PowerFeed
brief_fields = ['_occupied', 'cable', 'display', 'id', 'name', 'url'] brief_fields = ['_occupied', 'cable', 'display', 'id', 'name', 'url']
bulk_update_data = { bulk_update_data = {

View File

@ -31,7 +31,7 @@ class AppTest(APITestCase):
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
class WebhookTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class WebhookTest(APIViewTestCases.APIViewTestCase):
model = Webhook model = Webhook
brief_fields = ['display', 'id', 'name', 'url'] brief_fields = ['display', 'id', 'name', 'url']
create_data = [ create_data = [
@ -85,7 +85,7 @@ class WebhookTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTest
webhook.content_types.add(site_ct, rack_ct) webhook.content_types.add(site_ct, rack_ct)
class CustomFieldTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class CustomFieldTest(APIViewTestCases.APIViewTestCase):
model = CustomField model = CustomField
brief_fields = ['display', 'id', 'name', 'url'] brief_fields = ['display', 'id', 'name', 'url']
create_data = [ create_data = [
@ -132,7 +132,7 @@ class CustomFieldTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIView
cf.content_types.add(site_ct) cf.content_types.add(site_ct)
class CustomLinkTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class CustomLinkTest(APIViewTestCases.APIViewTestCase):
model = CustomLink model = CustomLink
brief_fields = ['display', 'id', 'name', 'url'] brief_fields = ['display', 'id', 'name', 'url']
create_data = [ create_data = [
@ -186,7 +186,7 @@ class CustomLinkTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewT
CustomLink.objects.bulk_create(custom_links) CustomLink.objects.bulk_create(custom_links)
class ExportTemplateTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class ExportTemplateTest(APIViewTestCases.APIViewTestCase):
model = ExportTemplate model = ExportTemplate
brief_fields = ['display', 'id', 'name', 'url'] brief_fields = ['display', 'id', 'name', 'url']
create_data = [ create_data = [
@ -234,7 +234,7 @@ class ExportTemplateTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIV
ExportTemplate.objects.bulk_create(export_templates) ExportTemplate.objects.bulk_create(export_templates)
class TagTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class TagTest(APIViewTestCases.APIViewTestCase):
model = Tag model = Tag
brief_fields = ['color', 'display', 'id', 'name', 'slug', 'url'] brief_fields = ['color', 'display', 'id', 'name', 'slug', 'url']
create_data = [ create_data = [
@ -311,7 +311,7 @@ class ImageAttachmentTest(
ImageAttachment.objects.bulk_create(image_attachments) ImageAttachment.objects.bulk_create(image_attachments)
class JournalEntryTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class JournalEntryTest(APIViewTestCases.APIViewTestCase):
model = JournalEntry model = JournalEntry
brief_fields = ['created', 'display', 'id', 'url'] brief_fields = ['created', 'display', 'id', 'url']
bulk_update_data = { bulk_update_data = {
@ -361,7 +361,7 @@ class JournalEntryTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIVie
] ]
class ConfigContextTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class ConfigContextTest(APIViewTestCases.APIViewTestCase):
model = ConfigContext model = ConfigContext
brief_fields = ['display', 'id', 'name', 'url'] brief_fields = ['display', 'id', 'name', 'url']
create_data = [ create_data = [

View File

@ -20,7 +20,7 @@ class AppTest(APITestCase):
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
class VRFTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class VRFTest(APIViewTestCases.APIViewTestCase):
model = VRF model = VRF
brief_fields = ['display', 'id', 'name', 'prefix_count', 'rd', 'url'] brief_fields = ['display', 'id', 'name', 'prefix_count', 'rd', 'url']
create_data = [ create_data = [
@ -52,7 +52,7 @@ class VRFTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase
VRF.objects.bulk_create(vrfs) VRF.objects.bulk_create(vrfs)
class RouteTargetTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class RouteTargetTest(APIViewTestCases.APIViewTestCase):
model = RouteTarget model = RouteTarget
brief_fields = ['display', 'id', 'name', 'url'] brief_fields = ['display', 'id', 'name', 'url']
create_data = [ create_data = [
@ -81,7 +81,7 @@ class RouteTargetTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIView
RouteTarget.objects.bulk_create(route_targets) RouteTarget.objects.bulk_create(route_targets)
class RIRTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class RIRTest(APIViewTestCases.APIViewTestCase):
model = RIR model = RIR
brief_fields = ['aggregate_count', 'display', 'id', 'name', 'slug', 'url'] brief_fields = ['aggregate_count', 'display', 'id', 'name', 'slug', 'url']
create_data = [ create_data = [
@ -113,7 +113,7 @@ class RIRTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase
RIR.objects.bulk_create(rirs) RIR.objects.bulk_create(rirs)
class AggregateTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class AggregateTest(APIViewTestCases.APIViewTestCase):
model = Aggregate model = Aggregate
brief_fields = ['display', 'family', 'id', 'prefix', 'url'] brief_fields = ['display', 'family', 'id', 'prefix', 'url']
bulk_update_data = { bulk_update_data = {
@ -152,7 +152,7 @@ class AggregateTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTe
] ]
class RoleTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class RoleTest(APIViewTestCases.APIViewTestCase):
model = Role model = Role
brief_fields = ['display', 'id', 'name', 'prefix_count', 'slug', 'url', 'vlan_count'] brief_fields = ['display', 'id', 'name', 'prefix_count', 'slug', 'url', 'vlan_count']
create_data = [ create_data = [
@ -184,7 +184,7 @@ class RoleTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCas
Role.objects.bulk_create(roles) Role.objects.bulk_create(roles)
class PrefixTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class PrefixTest(APIViewTestCases.APIViewTestCase):
model = Prefix model = Prefix
brief_fields = ['_depth', 'display', 'family', 'id', 'prefix', 'url'] brief_fields = ['_depth', 'display', 'family', 'id', 'prefix', 'url']
create_data = [ create_data = [
@ -358,7 +358,7 @@ class PrefixTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestC
self.assertEqual(len(response.data), 8) self.assertEqual(len(response.data), 8)
class IPAddressTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class IPAddressTest(APIViewTestCases.APIViewTestCase):
model = IPAddress model = IPAddress
brief_fields = ['address', 'display', 'family', 'id', 'url'] brief_fields = ['address', 'display', 'family', 'id', 'url']
create_data = [ create_data = [
@ -387,7 +387,7 @@ class IPAddressTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTe
IPAddress.objects.bulk_create(ip_addresses) IPAddress.objects.bulk_create(ip_addresses)
class VLANGroupTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class VLANGroupTest(APIViewTestCases.APIViewTestCase):
model = VLANGroup model = VLANGroup
brief_fields = ['display', 'id', 'name', 'slug', 'url', 'vlan_count'] brief_fields = ['display', 'id', 'name', 'slug', 'url', 'vlan_count']
create_data = [ create_data = [
@ -419,7 +419,7 @@ class VLANGroupTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTe
VLANGroup.objects.bulk_create(vlan_groups) VLANGroup.objects.bulk_create(vlan_groups)
class VLANTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class VLANTest(APIViewTestCases.APIViewTestCase):
model = VLAN model = VLAN
brief_fields = ['display', 'id', 'name', 'url', 'vid'] brief_fields = ['display', 'id', 'name', 'url', 'vid']
bulk_update_data = { bulk_update_data = {
@ -479,7 +479,7 @@ class VLANTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCas
self.assertTrue(content['detail'].startswith('Unable to delete object.')) self.assertTrue(content['detail'].startswith('Unable to delete object.'))
class ServiceTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class ServiceTest(APIViewTestCases.APIViewTestCase):
model = Service model = Service
brief_fields = ['display', 'id', 'name', 'ports', 'protocol', 'url'] brief_fields = ['display', 'id', 'name', 'ports', 'protocol', 'url']
bulk_update_data = { bulk_update_data = {

View File

@ -14,7 +14,7 @@ class AppTest(APITestCase):
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
class TenantGroupTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class TenantGroupTest(APIViewTestCases.APIViewTestCase):
model = TenantGroup model = TenantGroup
brief_fields = ['_depth', 'display', 'id', 'name', 'slug', 'tenant_count', 'url'] brief_fields = ['_depth', 'display', 'id', 'name', 'slug', 'tenant_count', 'url']
bulk_update_data = { bulk_update_data = {
@ -52,7 +52,7 @@ class TenantGroupTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIView
] ]
class TenantTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class TenantTest(APIViewTestCases.APIViewTestCase):
model = Tenant model = Tenant
brief_fields = ['display', 'id', 'name', 'slug', 'url'] brief_fields = ['display', 'id', 'name', 'slug', 'url']
bulk_update_data = { bulk_update_data = {

View File

@ -17,7 +17,7 @@ class AppTest(APITestCase):
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
class UserTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class UserTest(APIViewTestCases.APIViewTestCase):
model = User model = User
view_namespace = 'users' view_namespace = 'users'
brief_fields = ['display', 'id', 'url', 'username'] brief_fields = ['display', 'id', 'url', 'username']
@ -48,7 +48,7 @@ class UserTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCas
User.objects.bulk_create(users) User.objects.bulk_create(users)
class GroupTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class GroupTest(APIViewTestCases.APIViewTestCase):
model = Group model = Group
view_namespace = 'users' view_namespace = 'users'
brief_fields = ['display', 'id', 'name', 'url'] brief_fields = ['display', 'id', 'name', 'url']
@ -75,7 +75,14 @@ class GroupTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCa
Group.objects.bulk_create(users) Group.objects.bulk_create(users)
class TokenTest(APIViewTestCases.APIViewTestCase): class TokenTest(
# No GraphQL support for Token
APIViewTestCases.GetObjectViewTestCase,
APIViewTestCases.ListObjectsViewTestCase,
APIViewTestCases.CreateObjectViewTestCase,
APIViewTestCases.UpdateObjectViewTestCase,
APIViewTestCases.DeleteObjectViewTestCase
):
model = Token model = Token
brief_fields = ['display', 'id', 'key', 'url', 'write_enabled'] brief_fields = ['display', 'id', 'key', 'url', 'write_enabled']
bulk_update_data = { bulk_update_data = {
@ -138,7 +145,14 @@ class TokenTest(APIViewTestCases.APIViewTestCase):
self.assertEqual(response.status_code, 403) self.assertEqual(response.status_code, 403)
class ObjectPermissionTest(APIViewTestCases.APIViewTestCase): class ObjectPermissionTest(
# No GraphQL support for ObjectPermission
APIViewTestCases.GetObjectViewTestCase,
APIViewTestCases.ListObjectsViewTestCase,
APIViewTestCases.CreateObjectViewTestCase,
APIViewTestCases.UpdateObjectViewTestCase,
APIViewTestCases.DeleteObjectViewTestCase
):
model = ObjectPermission model = ObjectPermission
brief_fields = ['actions', 'display', 'enabled', 'groups', 'id', 'name', 'object_types', 'url', 'users'] brief_fields = ['actions', 'display', 'enabled', 'groups', 'id', 'name', 'object_types', 'url', 'users']

View File

@ -520,6 +520,7 @@ class APIViewTestCases:
ListObjectsViewTestCase, ListObjectsViewTestCase,
CreateObjectViewTestCase, CreateObjectViewTestCase,
UpdateObjectViewTestCase, UpdateObjectViewTestCase,
DeleteObjectViewTestCase DeleteObjectViewTestCase,
GraphQLTestCase
): ):
pass pass

View File

@ -17,7 +17,7 @@ class AppTest(APITestCase):
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
class ClusterTypeTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class ClusterTypeTest(APIViewTestCases.APIViewTestCase):
model = ClusterType model = ClusterType
brief_fields = ['cluster_count', 'display', 'id', 'name', 'slug', 'url'] brief_fields = ['cluster_count', 'display', 'id', 'name', 'slug', 'url']
create_data = [ create_data = [
@ -49,7 +49,7 @@ class ClusterTypeTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIView
ClusterType.objects.bulk_create(cluster_types) ClusterType.objects.bulk_create(cluster_types)
class ClusterGroupTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class ClusterGroupTest(APIViewTestCases.APIViewTestCase):
model = ClusterGroup model = ClusterGroup
brief_fields = ['cluster_count', 'display', 'id', 'name', 'slug', 'url'] brief_fields = ['cluster_count', 'display', 'id', 'name', 'slug', 'url']
create_data = [ create_data = [
@ -81,7 +81,7 @@ class ClusterGroupTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIVie
ClusterGroup.objects.bulk_create(cluster_Groups) ClusterGroup.objects.bulk_create(cluster_Groups)
class ClusterTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class ClusterTest(APIViewTestCases.APIViewTestCase):
model = Cluster model = Cluster
brief_fields = ['display', 'id', 'name', 'url', 'virtualmachine_count'] brief_fields = ['display', 'id', 'name', 'url', 'virtualmachine_count']
bulk_update_data = { bulk_update_data = {
@ -129,7 +129,7 @@ class ClusterTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTest
] ]
class VirtualMachineTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class VirtualMachineTest(APIViewTestCases.APIViewTestCase):
model = VirtualMachine model = VirtualMachine
brief_fields = ['display', 'id', 'name', 'url'] brief_fields = ['display', 'id', 'name', 'url']
bulk_update_data = { bulk_update_data = {
@ -205,7 +205,7 @@ class VirtualMachineTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIV
self.assertHttpStatus(response, status.HTTP_400_BAD_REQUEST) self.assertHttpStatus(response, status.HTTP_400_BAD_REQUEST)
class VMInterfaceTest(APIViewTestCases.GraphQLTestCase, APIViewTestCases.APIViewTestCase): class VMInterfaceTest(APIViewTestCases.APIViewTestCase):
model = VMInterface model = VMInterface
brief_fields = ['display', 'id', 'name', 'url', 'virtual_machine'] brief_fields = ['display', 'id', 'name', 'url', 'virtual_machine']
bulk_update_data = { bulk_update_data = {