mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-16 12:12:53 -06:00
Add cable trace view tests
This commit is contained in:
parent
d0be5f09a5
commit
608bf30bda
@ -1246,6 +1246,17 @@ class ConsolePortTestCase(ViewTestCases.DeviceComponentViewTestCase):
|
|||||||
"Device 1,Console Port 6",
|
"Device 1,Console Port 6",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_trace(self):
|
||||||
|
consoleport = ConsolePort.objects.first()
|
||||||
|
consoleserverport = ConsoleServerPort.objects.create(
|
||||||
|
device=consoleport.device,
|
||||||
|
name='Console Server Port 1'
|
||||||
|
)
|
||||||
|
Cable(termination_a=consoleport, termination_b=consoleserverport).save()
|
||||||
|
|
||||||
|
response = self.client.get(reverse('dcim:consoleport_trace', kwargs={'pk': consoleport.pk}))
|
||||||
|
self.assertHttpStatus(response, 200)
|
||||||
|
|
||||||
|
|
||||||
class ConsoleServerPortTestCase(ViewTestCases.DeviceComponentViewTestCase):
|
class ConsoleServerPortTestCase(ViewTestCases.DeviceComponentViewTestCase):
|
||||||
model = ConsoleServerPort
|
model = ConsoleServerPort
|
||||||
@ -1290,6 +1301,17 @@ class ConsoleServerPortTestCase(ViewTestCases.DeviceComponentViewTestCase):
|
|||||||
"Device 1,Console Server Port 6",
|
"Device 1,Console Server Port 6",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_trace(self):
|
||||||
|
consoleserverport = ConsoleServerPort.objects.first()
|
||||||
|
consoleport = ConsolePort.objects.create(
|
||||||
|
device=consoleserverport.device,
|
||||||
|
name='Console Port 1'
|
||||||
|
)
|
||||||
|
Cable(termination_a=consoleserverport, termination_b=consoleport).save()
|
||||||
|
|
||||||
|
response = self.client.get(reverse('dcim:consoleserverport_trace', kwargs={'pk': consoleserverport.pk}))
|
||||||
|
self.assertHttpStatus(response, 200)
|
||||||
|
|
||||||
|
|
||||||
class PowerPortTestCase(ViewTestCases.DeviceComponentViewTestCase):
|
class PowerPortTestCase(ViewTestCases.DeviceComponentViewTestCase):
|
||||||
model = PowerPort
|
model = PowerPort
|
||||||
@ -1340,6 +1362,17 @@ class PowerPortTestCase(ViewTestCases.DeviceComponentViewTestCase):
|
|||||||
"Device 1,Power Port 6",
|
"Device 1,Power Port 6",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_trace(self):
|
||||||
|
powerport = PowerPort.objects.first()
|
||||||
|
poweroutlet = PowerOutlet.objects.create(
|
||||||
|
device=powerport.device,
|
||||||
|
name='Power Outlet 1'
|
||||||
|
)
|
||||||
|
Cable(termination_a=powerport, termination_b=poweroutlet).save()
|
||||||
|
|
||||||
|
response = self.client.get(reverse('dcim:powerport_trace', kwargs={'pk': powerport.pk}))
|
||||||
|
self.assertHttpStatus(response, 200)
|
||||||
|
|
||||||
|
|
||||||
class PowerOutletTestCase(ViewTestCases.DeviceComponentViewTestCase):
|
class PowerOutletTestCase(ViewTestCases.DeviceComponentViewTestCase):
|
||||||
model = PowerOutlet
|
model = PowerOutlet
|
||||||
@ -1396,6 +1429,14 @@ class PowerOutletTestCase(ViewTestCases.DeviceComponentViewTestCase):
|
|||||||
"Device 1,Power Outlet 6",
|
"Device 1,Power Outlet 6",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_trace(self):
|
||||||
|
poweroutlet = PowerOutlet.objects.first()
|
||||||
|
powerport = PowerPort.objects.first()
|
||||||
|
Cable(termination_a=poweroutlet, termination_b=powerport).save()
|
||||||
|
|
||||||
|
response = self.client.get(reverse('dcim:poweroutlet_trace', kwargs={'pk': poweroutlet.pk}))
|
||||||
|
self.assertHttpStatus(response, 200)
|
||||||
|
|
||||||
|
|
||||||
class InterfaceTestCase(ViewTestCases.DeviceComponentViewTestCase):
|
class InterfaceTestCase(ViewTestCases.DeviceComponentViewTestCase):
|
||||||
model = Interface
|
model = Interface
|
||||||
@ -1475,6 +1516,13 @@ class InterfaceTestCase(ViewTestCases.DeviceComponentViewTestCase):
|
|||||||
"Device 1,Interface 6,1000base-t",
|
"Device 1,Interface 6,1000base-t",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_trace(self):
|
||||||
|
interface1, interface2 = Interface.objects.all()[:2]
|
||||||
|
Cable(termination_a=interface1, termination_b=interface2).save()
|
||||||
|
|
||||||
|
response = self.client.get(reverse('dcim:interface_trace', kwargs={'pk': interface1.pk}))
|
||||||
|
self.assertHttpStatus(response, 200)
|
||||||
|
|
||||||
|
|
||||||
class FrontPortTestCase(ViewTestCases.DeviceComponentViewTestCase):
|
class FrontPortTestCase(ViewTestCases.DeviceComponentViewTestCase):
|
||||||
model = FrontPort
|
model = FrontPort
|
||||||
@ -1534,6 +1582,17 @@ class FrontPortTestCase(ViewTestCases.DeviceComponentViewTestCase):
|
|||||||
"Device 1,Front Port 6,8p8c,Rear Port 6,1",
|
"Device 1,Front Port 6,8p8c,Rear Port 6,1",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_trace(self):
|
||||||
|
frontport = FrontPort.objects.first()
|
||||||
|
interface = Interface.objects.create(
|
||||||
|
device=frontport.device,
|
||||||
|
name='Interface 1'
|
||||||
|
)
|
||||||
|
Cable(termination_a=frontport, termination_b=interface).save()
|
||||||
|
|
||||||
|
response = self.client.get(reverse('dcim:frontport_trace', kwargs={'pk': frontport.pk}))
|
||||||
|
self.assertHttpStatus(response, 200)
|
||||||
|
|
||||||
|
|
||||||
class RearPortTestCase(ViewTestCases.DeviceComponentViewTestCase):
|
class RearPortTestCase(ViewTestCases.DeviceComponentViewTestCase):
|
||||||
model = RearPort
|
model = RearPort
|
||||||
@ -1580,6 +1639,17 @@ class RearPortTestCase(ViewTestCases.DeviceComponentViewTestCase):
|
|||||||
"Device 1,Rear Port 6,8p8c,1",
|
"Device 1,Rear Port 6,8p8c,1",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_trace(self):
|
||||||
|
rearport = RearPort.objects.first()
|
||||||
|
interface = Interface.objects.create(
|
||||||
|
device=rearport.device,
|
||||||
|
name='Interface 1'
|
||||||
|
)
|
||||||
|
Cable(termination_a=rearport, termination_b=interface).save()
|
||||||
|
|
||||||
|
response = self.client.get(reverse('dcim:rearport_trace', kwargs={'pk': rearport.pk}))
|
||||||
|
self.assertHttpStatus(response, 200)
|
||||||
|
|
||||||
|
|
||||||
class DeviceBayTestCase(ViewTestCases.DeviceComponentViewTestCase):
|
class DeviceBayTestCase(ViewTestCases.DeviceComponentViewTestCase):
|
||||||
model = DeviceBay
|
model = DeviceBay
|
||||||
@ -1938,3 +2008,25 @@ class PowerFeedTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
'max_utilization': 50,
|
'max_utilization': 50,
|
||||||
'comments': 'New comments',
|
'comments': 'New comments',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def test_trace(self):
|
||||||
|
manufacturer = Manufacturer.objects.create(name='Manufacturer', slug='manufacturer-1')
|
||||||
|
device_type = DeviceType.objects.create(
|
||||||
|
manufacturer=manufacturer, model='Device Type 1', slug='device-type-1'
|
||||||
|
)
|
||||||
|
device_role = DeviceRole.objects.create(
|
||||||
|
name='Device Role', slug='device-role-1'
|
||||||
|
)
|
||||||
|
device = Device.objects.create(
|
||||||
|
site=Site.objects.first(), device_type=device_type, device_role=device_role
|
||||||
|
)
|
||||||
|
|
||||||
|
powerfeed = PowerFeed.objects.first()
|
||||||
|
powerport = PowerPort.objects.create(
|
||||||
|
device=device,
|
||||||
|
name='Power Port 1'
|
||||||
|
)
|
||||||
|
Cable(termination_a=powerfeed, termination_b=powerport).save()
|
||||||
|
|
||||||
|
response = self.client.get(reverse('dcim:powerfeed_trace', kwargs={'pk': powerfeed.pk}))
|
||||||
|
self.assertHttpStatus(response, 200)
|
||||||
|
Loading…
Reference in New Issue
Block a user