1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Enable tests for component bulk edit views

This commit is contained in:
Jeremy Stretch
2020-02-05 11:14:07 -05:00
parent 57a0cf0a33
commit 6b9fa5e76f
4 changed files with 60 additions and 17 deletions

View File

@@ -202,7 +202,6 @@ class InterfaceTestCase(StandardTestCases.Views):
# TODO
test_create_object = None
test_bulk_edit_objects = None
def _get_base_url(self):
# Interface belongs to the DCIM app, so we have to override the base URL
@@ -222,9 +221,9 @@ class InterfaceTestCase(StandardTestCases.Views):
VirtualMachine.objects.bulk_create(virtualmachines)
Interface.objects.bulk_create([
Interface(virtual_machine=virtualmachines[0], name='Interface 1'),
Interface(virtual_machine=virtualmachines[0], name='Interface 2'),
Interface(virtual_machine=virtualmachines[0], name='Interface 3'),
Interface(virtual_machine=virtualmachines[0], name='Interface 1', type=InterfaceTypeChoices.TYPE_VIRTUAL),
Interface(virtual_machine=virtualmachines[0], name='Interface 2', type=InterfaceTypeChoices.TYPE_VIRTUAL),
Interface(virtual_machine=virtualmachines[0], name='Interface 3', type=InterfaceTypeChoices.TYPE_VIRTUAL),
])
vlans = (
@@ -262,3 +261,13 @@ class InterfaceTestCase(StandardTestCases.Views):
"Device 1,Interface 5,1000BASE-T (1GE)",
"Device 1,Interface 6,1000BASE-T (1GE)",
)
cls.bulk_edit_data = {
'virtual_machine': virtualmachines[1].pk,
'enabled': False,
'mtu': 2000,
'description': 'New description',
'mode': InterfaceModeChoices.MODE_TAGGED,
# 'untagged_vlan': vlans[0].pk,
# 'tagged_vlans': [v.pk for v in vlans[1:4]],
}

View File

@@ -353,7 +353,6 @@ class InterfaceDeleteView(PermissionRequiredMixin, ObjectDeleteView):
class InterfaceBulkEditView(PermissionRequiredMixin, BulkEditView):
permission_required = 'dcim.change_interface'
queryset = Interface.objects.all()
parent_model = VirtualMachine
table = tables.InterfaceTable
form = forms.InterfaceBulkEditForm
@@ -361,7 +360,6 @@ class InterfaceBulkEditView(PermissionRequiredMixin, BulkEditView):
class InterfaceBulkDeleteView(PermissionRequiredMixin, BulkDeleteView):
permission_required = 'dcim.delete_interface'
queryset = Interface.objects.all()
parent_model = VirtualMachine
table = tables.InterfaceTable