mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 04:22:01 -06:00
Fixed tests
This commit is contained in:
parent
aa8442a345
commit
a75d7079df
@ -1462,7 +1462,7 @@ class Interface(models.Model):
|
|||||||
self.untagged_vlan = None
|
self.untagged_vlan = None
|
||||||
|
|
||||||
# Only "tagged" interfaces may have tagged VLANs assigned. ("tagged all" implies all VLANs are assigned.)
|
# Only "tagged" interfaces may have tagged VLANs assigned. ("tagged all" implies all VLANs are assigned.)
|
||||||
if self.mode is not IFACE_MODE_TAGGED:
|
if self.pk and self.mode is not IFACE_MODE_TAGGED:
|
||||||
self.tagged_vlans.clear()
|
self.tagged_vlans.clear()
|
||||||
|
|
||||||
return super(Interface, self).save(*args, **kwargs)
|
return super(Interface, self).save(*args, **kwargs)
|
||||||
|
@ -5,7 +5,9 @@ from django.urls import reverse
|
|||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
from rest_framework.test import APITestCase
|
from rest_framework.test import APITestCase
|
||||||
|
|
||||||
from dcim.constants import IFACE_FF_1GE_FIXED, IFACE_FF_LAG, SUBDEVICE_ROLE_CHILD, SUBDEVICE_ROLE_PARENT
|
from dcim.constants import (
|
||||||
|
IFACE_FF_1GE_FIXED, IFACE_FF_LAG, IFACE_MODE_TAGGED, SUBDEVICE_ROLE_CHILD, SUBDEVICE_ROLE_PARENT,
|
||||||
|
)
|
||||||
from dcim.models import (
|
from dcim.models import (
|
||||||
ConsolePort, ConsolePortTemplate, ConsoleServerPort, ConsoleServerPortTemplate, Device, DeviceBay,
|
ConsolePort, ConsolePortTemplate, ConsoleServerPort, ConsoleServerPortTemplate, Device, DeviceBay,
|
||||||
DeviceBayTemplate, DeviceRole, DeviceType, Interface, InterfaceConnection, InterfaceTemplate, Manufacturer,
|
DeviceBayTemplate, DeviceRole, DeviceType, Interface, InterfaceConnection, InterfaceTemplate, Manufacturer,
|
||||||
@ -2319,6 +2321,7 @@ class InterfaceTest(HttpStatusMixin, APITestCase):
|
|||||||
data = {
|
data = {
|
||||||
'device': self.device.pk,
|
'device': self.device.pk,
|
||||||
'name': 'Test Interface 4',
|
'name': 'Test Interface 4',
|
||||||
|
'mode': IFACE_MODE_TAGGED,
|
||||||
'tagged_vlans': [self.vlan1.id, self.vlan2.id],
|
'tagged_vlans': [self.vlan1.id, self.vlan2.id],
|
||||||
'untagged_vlan': self.vlan3.id
|
'untagged_vlan': self.vlan3.id
|
||||||
}
|
}
|
||||||
@ -2366,18 +2369,21 @@ class InterfaceTest(HttpStatusMixin, APITestCase):
|
|||||||
{
|
{
|
||||||
'device': self.device.pk,
|
'device': self.device.pk,
|
||||||
'name': 'Test Interface 4',
|
'name': 'Test Interface 4',
|
||||||
|
'mode': IFACE_MODE_TAGGED,
|
||||||
'tagged_vlans': [self.vlan1.id],
|
'tagged_vlans': [self.vlan1.id],
|
||||||
'untagged_vlan': self.vlan2.id,
|
'untagged_vlan': self.vlan2.id,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'device': self.device.pk,
|
'device': self.device.pk,
|
||||||
'name': 'Test Interface 5',
|
'name': 'Test Interface 5',
|
||||||
|
'mode': IFACE_MODE_TAGGED,
|
||||||
'tagged_vlans': [self.vlan1.id],
|
'tagged_vlans': [self.vlan1.id],
|
||||||
'untagged_vlan': self.vlan2.id,
|
'untagged_vlan': self.vlan2.id,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'device': self.device.pk,
|
'device': self.device.pk,
|
||||||
'name': 'Test Interface 6',
|
'name': 'Test Interface 6',
|
||||||
|
'mode': IFACE_MODE_TAGGED,
|
||||||
'tagged_vlans': [self.vlan1.id],
|
'tagged_vlans': [self.vlan1.id],
|
||||||
'untagged_vlan': self.vlan2.id,
|
'untagged_vlan': self.vlan2.id,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user