Wrap ComponentTraceMixin in a parent class

This commit is contained in:
Jeremy Stretch 2020-06-29 15:14:12 -04:00
parent 36498c9dd2
commit 15f32bdd73

View File

@ -28,6 +28,8 @@ class AppTest(APITestCase):
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
class Mixins:
class ComponentTraceMixin(APITestCase): class ComponentTraceMixin(APITestCase):
peer_termination_type = None peer_termination_type = None
@ -956,7 +958,7 @@ class DeviceTest(APIViewTestCases.APIViewTestCase):
self.assertHttpStatus(response, status.HTTP_400_BAD_REQUEST) self.assertHttpStatus(response, status.HTTP_400_BAD_REQUEST)
class ConsolePortTest(ComponentTraceMixin, APIViewTestCases.APIViewTestCase): class ConsolePortTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIViewTestCase):
model = ConsolePort model = ConsolePort
brief_fields = ['cable', 'connection_status', 'device', 'id', 'name', 'url'] brief_fields = ['cable', 'connection_status', 'device', 'id', 'name', 'url']
peer_termination_type = ConsoleServerPort peer_termination_type = ConsoleServerPort
@ -992,7 +994,7 @@ class ConsolePortTest(ComponentTraceMixin, APIViewTestCases.APIViewTestCase):
] ]
class ConsoleServerPortTest(ComponentTraceMixin, APIViewTestCases.APIViewTestCase): class ConsoleServerPortTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIViewTestCase):
model = ConsoleServerPort model = ConsoleServerPort
brief_fields = ['cable', 'connection_status', 'device', 'id', 'name', 'url'] brief_fields = ['cable', 'connection_status', 'device', 'id', 'name', 'url']
peer_termination_type = ConsolePort peer_termination_type = ConsolePort
@ -1028,7 +1030,7 @@ class ConsoleServerPortTest(ComponentTraceMixin, APIViewTestCases.APIViewTestCas
] ]
class PowerPortTest(ComponentTraceMixin, APIViewTestCases.APIViewTestCase): class PowerPortTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIViewTestCase):
model = PowerPort model = PowerPort
brief_fields = ['cable', 'connection_status', 'device', 'id', 'name', 'url'] brief_fields = ['cable', 'connection_status', 'device', 'id', 'name', 'url']
peer_termination_type = PowerOutlet peer_termination_type = PowerOutlet
@ -1064,7 +1066,7 @@ class PowerPortTest(ComponentTraceMixin, APIViewTestCases.APIViewTestCase):
] ]
class PowerOutletTest(ComponentTraceMixin, APIViewTestCases.APIViewTestCase): class PowerOutletTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIViewTestCase):
model = PowerOutlet model = PowerOutlet
brief_fields = ['cable', 'connection_status', 'device', 'id', 'name', 'url'] brief_fields = ['cable', 'connection_status', 'device', 'id', 'name', 'url']
peer_termination_type = PowerPort peer_termination_type = PowerPort
@ -1100,7 +1102,7 @@ class PowerOutletTest(ComponentTraceMixin, APIViewTestCases.APIViewTestCase):
] ]
class InterfaceTest(ComponentTraceMixin, APIViewTestCases.APIViewTestCase): class InterfaceTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIViewTestCase):
model = Interface model = Interface
brief_fields = ['cable', 'connection_status', 'device', 'id', 'name', 'url'] brief_fields = ['cable', 'connection_status', 'device', 'id', 'name', 'url']
peer_termination_type = Interface peer_termination_type = Interface
@ -1174,7 +1176,7 @@ class InterfaceTest(ComponentTraceMixin, APIViewTestCases.APIViewTestCase):
self.assertEqual(response.data[0]['embed_url'], 'http://example.com/graphs.py?interface=Interface 1&foo=1') self.assertEqual(response.data[0]['embed_url'], 'http://example.com/graphs.py?interface=Interface 1&foo=1')
class FrontPortTest(ComponentTraceMixin, APIViewTestCases.APIViewTestCase): class FrontPortTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIViewTestCase):
model = FrontPort model = FrontPort
brief_fields = ['cable', 'device', 'id', 'name', 'url'] brief_fields = ['cable', 'device', 'id', 'name', 'url']
peer_termination_type = Interface peer_termination_type = Interface
@ -1229,7 +1231,7 @@ class FrontPortTest(ComponentTraceMixin, APIViewTestCases.APIViewTestCase):
] ]
class RearPortTest(ComponentTraceMixin, APIViewTestCases.APIViewTestCase): class RearPortTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIViewTestCase):
model = RearPort model = RearPort
brief_fields = ['cable', 'device', 'id', 'name', 'url'] brief_fields = ['cable', 'device', 'id', 'name', 'url']
peer_termination_type = Interface peer_termination_type = Interface