mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-25 00:36:11 -06:00
7961 update tests
This commit is contained in:
parent
8018b3aa87
commit
c84621e86c
@ -909,7 +909,8 @@ class L2VPNTerminationTestCase(
|
||||
def setUpTestData(cls):
|
||||
device = create_test_device('Device 1')
|
||||
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 = (
|
||||
VLAN(name='Vlan 1', vid=1001),
|
||||
@ -942,10 +943,10 @@ class L2VPNTerminationTestCase(
|
||||
)
|
||||
|
||||
cls.csv_update_data = (
|
||||
"vlan",
|
||||
"Vlan 1",
|
||||
"Vlan 2",
|
||||
"Vlan 3",
|
||||
"l2vpn",
|
||||
"L2VPN 2",
|
||||
"L2VPN 2",
|
||||
"L2VPN 2",
|
||||
)
|
||||
|
||||
cls.bulk_edit_data = {}
|
||||
|
@ -2,6 +2,7 @@ import csv
|
||||
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.db.models import ForeignKey
|
||||
from django.test import override_settings
|
||||
from django.urls import reverse
|
||||
|
||||
@ -21,6 +22,7 @@ __all__ = (
|
||||
# UI Tests
|
||||
#
|
||||
|
||||
|
||||
class ModelViewTestCase(ModelTestCase):
|
||||
"""
|
||||
Base TestCase for model views. Subclass to test individual views.
|
||||
@ -637,7 +639,11 @@ class ViewTestCases:
|
||||
obj = self.model.objects.get(id=line["id"])
|
||||
for attr, value in line.items():
|
||||
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=['*'])
|
||||
def test_bulk_import_objects_with_constrained_permission(self):
|
||||
|
@ -151,10 +151,10 @@ class WirelessLinkTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
)
|
||||
|
||||
cls.csv_update_data = (
|
||||
f"status",
|
||||
f"{LinkStatusChoices.STATUS_PLANNED}",
|
||||
f"{LinkStatusChoices.STATUS_PLANNED}",
|
||||
f"{LinkStatusChoices.STATUS_PLANNED}",
|
||||
"ssid,description",
|
||||
"LINK7,New decription 7",
|
||||
"LINK8,New decription 8",
|
||||
"LINK9,New decription 9",
|
||||
)
|
||||
|
||||
cls.bulk_edit_data = {
|
||||
|
Loading…
Reference in New Issue
Block a user