mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-25 08:46:10 -06:00
7961 update tests
This commit is contained in:
parent
8018b3aa87
commit
c84621e86c
@ -909,7 +909,8 @@ class L2VPNTerminationTestCase(
|
|||||||
def setUpTestData(cls):
|
def setUpTestData(cls):
|
||||||
device = create_test_device('Device 1')
|
device = create_test_device('Device 1')
|
||||||
interface = Interface.objects.create(name='Interface 1', device=device, type='1000baset')
|
interface = Interface.objects.create(name='Interface 1', device=device, type='1000baset')
|
||||||
l2vpn = L2VPN.objects.create(name='L2VPN 1', type=L2VPNTypeChoices.TYPE_VXLAN, identifier=650001)
|
l2vpn = L2VPN.objects.create(name='L2VPN 1', slug='l2vpn-1', type=L2VPNTypeChoices.TYPE_VXLAN, identifier=650001)
|
||||||
|
l2vpn2 = L2VPN.objects.create(name='L2VPN 2', slug='l2vpn-2', type=L2VPNTypeChoices.TYPE_VXLAN, identifier=650002)
|
||||||
|
|
||||||
vlans = (
|
vlans = (
|
||||||
VLAN(name='Vlan 1', vid=1001),
|
VLAN(name='Vlan 1', vid=1001),
|
||||||
@ -942,10 +943,10 @@ class L2VPNTerminationTestCase(
|
|||||||
)
|
)
|
||||||
|
|
||||||
cls.csv_update_data = (
|
cls.csv_update_data = (
|
||||||
"vlan",
|
"l2vpn",
|
||||||
"Vlan 1",
|
"L2VPN 2",
|
||||||
"Vlan 2",
|
"L2VPN 2",
|
||||||
"Vlan 3",
|
"L2VPN 2",
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.bulk_edit_data = {}
|
cls.bulk_edit_data = {}
|
||||||
|
@ -2,6 +2,7 @@ import csv
|
|||||||
|
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
|
from django.db.models import ForeignKey
|
||||||
from django.test import override_settings
|
from django.test import override_settings
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
@ -21,6 +22,7 @@ __all__ = (
|
|||||||
# UI Tests
|
# UI Tests
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
class ModelViewTestCase(ModelTestCase):
|
class ModelViewTestCase(ModelTestCase):
|
||||||
"""
|
"""
|
||||||
Base TestCase for model views. Subclass to test individual views.
|
Base TestCase for model views. Subclass to test individual views.
|
||||||
@ -637,7 +639,11 @@ class ViewTestCases:
|
|||||||
obj = self.model.objects.get(id=line["id"])
|
obj = self.model.objects.get(id=line["id"])
|
||||||
for attr, value in line.items():
|
for attr, value in line.items():
|
||||||
if attr != "id":
|
if attr != "id":
|
||||||
self.assertEqual(value, getattr(obj, attr))
|
field = self.model._meta.get_field(attr)
|
||||||
|
value = getattr(obj, attr)
|
||||||
|
# cannot verify FK fields as don't know what name the CSV maps to
|
||||||
|
if value is not None and not isinstance(field, ForeignKey):
|
||||||
|
self.assertEqual(value, value)
|
||||||
|
|
||||||
@override_settings(EXEMPT_VIEW_PERMISSIONS=['*'])
|
@override_settings(EXEMPT_VIEW_PERMISSIONS=['*'])
|
||||||
def test_bulk_import_objects_with_constrained_permission(self):
|
def test_bulk_import_objects_with_constrained_permission(self):
|
||||||
|
@ -151,10 +151,10 @@ class WirelessLinkTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
cls.csv_update_data = (
|
cls.csv_update_data = (
|
||||||
f"status",
|
"ssid,description",
|
||||||
f"{LinkStatusChoices.STATUS_PLANNED}",
|
"LINK7,New decription 7",
|
||||||
f"{LinkStatusChoices.STATUS_PLANNED}",
|
"LINK8,New decription 8",
|
||||||
f"{LinkStatusChoices.STATUS_PLANNED}",
|
"LINK9,New decription 9",
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.bulk_edit_data = {
|
cls.bulk_edit_data = {
|
||||||
|
Loading…
Reference in New Issue
Block a user