diff --git a/netbox/tenancy/tests/test_api.py b/netbox/tenancy/tests/test_api.py index 5a6fe0453..c32ad3826 100644 --- a/netbox/tenancy/tests/test_api.py +++ b/netbox/tenancy/tests/test_api.py @@ -239,9 +239,24 @@ class ContactAssignmentTest(APIViewTestCases.APIViewTestCase): ContactRole.objects.bulk_create(contact_roles) contact_assignments = ( - ContactAssignment(object=sites[0], contact=contacts[0], role=contact_roles[0], priority=ContactPriorityChoices.PRIORITY_PRIMARY), - ContactAssignment(object=sites[0], contact=contacts[1], role=contact_roles[1], priority=ContactPriorityChoices.PRIORITY_SECONDARY), - ContactAssignment(object=sites[0], contact=contacts[2], role=contact_roles[2], priority=ContactPriorityChoices.PRIORITY_TERTIARY), + ContactAssignment( + object=sites[0], + contact=contacts[0], + role=contact_roles[0], + priority=ContactPriorityChoices.PRIORITY_PRIMARY, + ), + ContactAssignment( + object=sites[0], + contact=contacts[1], + role=contact_roles[1], + priority=ContactPriorityChoices.PRIORITY_SECONDARY, + ), + ContactAssignment( + object=sites[0], + contact=contacts[2], + role=contact_roles[2], + priority=ContactPriorityChoices.PRIORITY_TERTIARY, + ), ) ContactAssignment.objects.bulk_create(contact_assignments) diff --git a/netbox/users/tests/test_filtersets.py b/netbox/users/tests/test_filtersets.py index fdf25d970..8b683b346 100644 --- a/netbox/users/tests/test_filtersets.py +++ b/netbox/users/tests/test_filtersets.py @@ -286,9 +286,15 @@ class TokenTestCase(TestCase, BaseFilterSetTests): future_date = make_aware(datetime.datetime(3000, 1, 1)) past_date = make_aware(datetime.datetime(2000, 1, 1)) tokens = ( - Token(user=users[0], key=Token.generate_key(), expires=future_date, write_enabled=True, description='foobar1'), - Token(user=users[1], key=Token.generate_key(), expires=future_date, write_enabled=True, description='foobar2'), - Token(user=users[2], key=Token.generate_key(), expires=past_date, write_enabled=False), + Token( + user=users[0], key=Token.generate_key(), expires=future_date, write_enabled=True, description='foobar1' + ), + Token( + user=users[1], key=Token.generate_key(), expires=future_date, write_enabled=True, description='foobar2' + ), + Token( + user=users[2], key=Token.generate_key(), expires=past_date, write_enabled=False + ), ) Token.objects.bulk_create(tokens) diff --git a/netbox/users/tests/test_views.py b/netbox/users/tests/test_views.py index 8386364dd..8226a8be9 100644 --- a/netbox/users/tests/test_views.py +++ b/netbox/users/tests/test_views.py @@ -23,11 +23,16 @@ class UserTestCase( @classmethod def setUpTestData(cls): - users = ( - User(username='username1', first_name='first1', last_name='last1', email='user1@foo.com', password='pass1xxx'), - User(username='username2', first_name='first2', last_name='last2', email='user2@foo.com', password='pass2xxx'), - User(username='username3', first_name='first3', last_name='last3', email='user3@foo.com', password='pass3xxx'), + User( + username='username1', first_name='first1', last_name='last1', email='user1@foo.com', password='pass1xxx' + ), + User( + username='username2', first_name='first2', last_name='last2', email='user2@foo.com', password='pass2xxx' + ), + User( + username='username3', first_name='first3', last_name='last3', email='user3@foo.com', password='pass3xxx' + ), ) User.objects.bulk_create(users) diff --git a/netbox/utilities/socks.py b/netbox/utilities/socks.py index bb0b6b250..6b62e8fc7 100644 --- a/netbox/utilities/socks.py +++ b/netbox/utilities/socks.py @@ -26,7 +26,10 @@ class ProxyHTTPConnection(HTTPConnection): try: from python_socks.sync import Proxy except ModuleNotFoundError as e: - logger.info("Configuring an HTTP proxy using SOCKS requires the python_socks library. Check that it has been installed.") + logger.info( + "Configuring an HTTP proxy using SOCKS requires the python_socks library. Check that it has been " + "installed." + ) raise e proxy = Proxy.from_url(self._proxy_url, rdns=self.use_rdns) diff --git a/netbox/utilities/testing/api.py b/netbox/utilities/testing/api.py index 0471b1cfd..12e38a27f 100644 --- a/netbox/utilities/testing/api.py +++ b/netbox/utilities/testing/api.py @@ -443,7 +443,10 @@ class APIViewTestCases: # Compile list of fields to include fields_string = '' - file_fields = (strawberry_django.fields.types.DjangoFileType, strawberry_django.fields.types.DjangoImageType) + file_fields = ( + strawberry_django.fields.types.DjangoFileType, + strawberry_django.fields.types.DjangoImageType, + ) for field in type_class.__strawberry_definition__.fields: if ( field.type in file_fields or ( diff --git a/netbox/utilities/tests/test_filters.py b/netbox/utilities/tests/test_filters.py index 031f31a12..6956396d2 100644 --- a/netbox/utilities/tests/test_filters.py +++ b/netbox/utilities/tests/test_filters.py @@ -427,9 +427,46 @@ class DynamicFilterLookupExpressionTest(TestCase): Rack.objects.bulk_create(racks) devices = ( - Device(name='Device 1', device_type=device_types[0], role=roles[0], platform=platforms[0], serial='ABC', asset_tag='1001', site=sites[0], rack=racks[0], position=1, face=DeviceFaceChoices.FACE_FRONT, status=DeviceStatusChoices.STATUS_ACTIVE, local_context_data={"foo": 123}), - Device(name='Device 2', device_type=device_types[1], role=roles[1], platform=platforms[1], serial='DEF', asset_tag='1002', site=sites[1], rack=racks[1], position=2, face=DeviceFaceChoices.FACE_FRONT, status=DeviceStatusChoices.STATUS_STAGED), - Device(name='Device 3', device_type=device_types[2], role=roles[2], platform=platforms[2], serial='GHI', asset_tag='1003', site=sites[2], rack=racks[2], position=3, face=DeviceFaceChoices.FACE_REAR, status=DeviceStatusChoices.STATUS_FAILED), + Device( + name='Device 1', + device_type=device_types[0], + role=roles[0], + platform=platforms[0], + serial='ABC', + asset_tag='1001', + site=sites[0], + rack=racks[0], + position=1, + face=DeviceFaceChoices.FACE_FRONT, + status=DeviceStatusChoices.STATUS_ACTIVE, + local_context_data={'foo': 123}, + ), + Device( + name='Device 2', + device_type=device_types[1], + role=roles[1], + platform=platforms[1], + serial='DEF', + asset_tag='1002', + site=sites[1], + rack=racks[1], + position=2, + face=DeviceFaceChoices.FACE_FRONT, + status=DeviceStatusChoices.STATUS_STAGED, + ), + Device( + name='Device 3', + device_type=device_types[2], + role=roles[2], + platform=platforms[2], + serial='GHI', + asset_tag='1003', + site=sites[2], + rack=racks[2], + position=3, + face=DeviceFaceChoices.FACE_REAR, + status=DeviceStatusChoices.STATUS_FAILED, + ), ) Device.objects.bulk_create(devices) diff --git a/netbox/virtualization/api/serializers_/clusters.py b/netbox/virtualization/api/serializers_/clusters.py index 450924fef..ff64db1cf 100644 --- a/netbox/virtualization/api/serializers_/clusters.py +++ b/netbox/virtualization/api/serializers_/clusters.py @@ -75,9 +75,9 @@ class ClusterSerializer(NetBoxModelSerializer): class Meta: model = Cluster fields = [ - 'id', 'url', 'display_url', 'display', 'name', 'type', 'group', 'status', 'tenant', 'scope_type', 'scope_id', 'scope', - 'description', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', 'device_count', - 'virtualmachine_count', 'allocated_vcpus', 'allocated_memory', 'allocated_disk' + 'id', 'url', 'display_url', 'display', 'name', 'type', 'group', 'status', 'tenant', 'scope_type', + 'scope_id', 'scope', 'description', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', + 'device_count', 'virtualmachine_count', 'allocated_vcpus', 'allocated_memory', 'allocated_disk' ] brief_fields = ('id', 'url', 'display', 'name', 'description', 'virtualmachine_count') diff --git a/netbox/virtualization/api/serializers_/virtualmachines.py b/netbox/virtualization/api/serializers_/virtualmachines.py index dfc205b7c..05fa2e427 100644 --- a/netbox/virtualization/api/serializers_/virtualmachines.py +++ b/netbox/virtualization/api/serializers_/virtualmachines.py @@ -49,8 +49,8 @@ class VirtualMachineSerializer(NetBoxModelSerializer): class Meta: model = VirtualMachine fields = [ - 'id', 'url', 'display_url', 'display', 'name', 'status', 'site', 'cluster', 'device', 'serial', 'role', 'tenant', - 'platform', 'primary_ip', 'primary_ip4', 'primary_ip6', 'vcpus', 'memory', 'disk', 'description', + 'id', 'url', 'display_url', 'display', 'name', 'status', 'site', 'cluster', 'device', 'serial', 'role', + 'tenant', 'platform', 'primary_ip', 'primary_ip4', 'primary_ip6', 'vcpus', 'memory', 'disk', 'description', 'comments', 'config_template', 'local_context_data', 'tags', 'custom_fields', 'created', 'last_updated', 'interface_count', 'virtual_disk_count', ] @@ -62,8 +62,8 @@ class VirtualMachineWithConfigContextSerializer(VirtualMachineSerializer): class Meta(VirtualMachineSerializer.Meta): fields = [ - 'id', 'url', 'display_url', 'display', 'name', 'status', 'site', 'cluster', 'device', 'serial', 'role', 'tenant', - 'platform', 'primary_ip', 'primary_ip4', 'primary_ip6', 'vcpus', 'memory', 'disk', 'description', + 'id', 'url', 'display_url', 'display', 'name', 'status', 'site', 'cluster', 'device', 'serial', 'role', + 'tenant', 'platform', 'primary_ip', 'primary_ip4', 'primary_ip6', 'vcpus', 'memory', 'disk', 'description', 'comments', 'config_template', 'local_context_data', 'tags', 'custom_fields', 'config_context', 'created', 'last_updated', 'interface_count', 'virtual_disk_count', ] diff --git a/netbox/virtualization/forms/bulk_import.py b/netbox/virtualization/forms/bulk_import.py index 027f3b309..6b5b62d11 100644 --- a/netbox/virtualization/forms/bulk_import.py +++ b/netbox/virtualization/forms/bulk_import.py @@ -73,7 +73,9 @@ class ClusterImportForm(ScopedImportForm, NetBoxModelImportForm): class Meta: model = Cluster - fields = ('name', 'type', 'group', 'status', 'scope_type', 'scope_id', 'tenant', 'description', 'comments', 'tags') + fields = ( + 'name', 'type', 'group', 'status', 'scope_type', 'scope_id', 'tenant', 'description', 'comments', 'tags', + ) labels = { 'scope_id': _('Scope ID'), } diff --git a/netbox/virtualization/tables/clusters.py b/netbox/virtualization/tables/clusters.py index 91807e35b..d07bb4519 100644 --- a/netbox/virtualization/tables/clusters.py +++ b/netbox/virtualization/tables/clusters.py @@ -100,7 +100,7 @@ class ClusterTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable): class Meta(NetBoxTable.Meta): model = Cluster fields = ( - 'pk', 'id', 'name', 'type', 'group', 'status', 'tenant', 'tenant_group', 'scope', 'scope_type', 'description', - 'comments', 'device_count', 'vm_count', 'contacts', 'tags', 'created', 'last_updated', + 'pk', 'id', 'name', 'type', 'group', 'status', 'tenant', 'tenant_group', 'scope', 'scope_type', + 'description', 'comments', 'device_count', 'vm_count', 'contacts', 'tags', 'created', 'last_updated', ) default_columns = ('pk', 'name', 'type', 'group', 'status', 'tenant', 'site', 'device_count', 'vm_count') diff --git a/netbox/virtualization/tests/test_api.py b/netbox/virtualization/tests/test_api.py index 149b64684..c57b57f2e 100644 --- a/netbox/virtualization/tests/test_api.py +++ b/netbox/virtualization/tests/test_api.py @@ -109,9 +109,24 @@ class ClusterTest(APIViewTestCases.APIViewTestCase): ClusterGroup.objects.bulk_create(cluster_groups) clusters = ( - Cluster(name='Cluster 1', type=cluster_types[0], group=cluster_groups[0], status=ClusterStatusChoices.STATUS_PLANNED), - Cluster(name='Cluster 2', type=cluster_types[0], group=cluster_groups[0], status=ClusterStatusChoices.STATUS_PLANNED), - Cluster(name='Cluster 3', type=cluster_types[0], group=cluster_groups[0], status=ClusterStatusChoices.STATUS_PLANNED), + Cluster( + name='Cluster 1', + type=cluster_types[0], + group=cluster_groups[0], + status=ClusterStatusChoices.STATUS_PLANNED, + ), + Cluster( + name='Cluster 2', + type=cluster_types[0], + group=cluster_groups[0], + status=ClusterStatusChoices.STATUS_PLANNED, + ), + Cluster( + name='Cluster 3', + type=cluster_types[0], + group=cluster_groups[0], + status=ClusterStatusChoices.STATUS_PLANNED, + ), ) for cluster in clusters: cluster.save() @@ -169,9 +184,25 @@ class VirtualMachineTest(APIViewTestCases.APIViewTestCase): device2 = create_test_device('device2', site=sites[1], cluster=clusters[1]) virtual_machines = ( - VirtualMachine(name='Virtual Machine 1', site=sites[0], cluster=clusters[0], device=device1, local_context_data={'A': 1}), - VirtualMachine(name='Virtual Machine 2', site=sites[0], cluster=clusters[0], local_context_data={'B': 2}), - VirtualMachine(name='Virtual Machine 3', site=sites[0], cluster=clusters[0], local_context_data={'C': 3}), + VirtualMachine( + name='Virtual Machine 1', + site=sites[0], + cluster=clusters[0], + device=device1, + local_context_data={'A': 1}, + ), + VirtualMachine( + name='Virtual Machine 2', + site=sites[0], + cluster=clusters[0], + local_context_data={'B': 2 + }), + VirtualMachine( + name='Virtual Machine 3', + site=sites[0], + cluster=clusters[0], + local_context_data={'C': 3} + ), ) VirtualMachine.objects.bulk_create(virtual_machines) diff --git a/netbox/virtualization/tests/test_views.py b/netbox/virtualization/tests/test_views.py index dfd7e041c..3c8d7eadc 100644 --- a/netbox/virtualization/tests/test_views.py +++ b/netbox/virtualization/tests/test_views.py @@ -117,9 +117,27 @@ class ClusterTestCase(ViewTestCases.PrimaryObjectViewTestCase): ClusterType.objects.bulk_create(clustertypes) clusters = ( - Cluster(name='Cluster 1', group=clustergroups[0], type=clustertypes[0], status=ClusterStatusChoices.STATUS_ACTIVE, scope=sites[0]), - Cluster(name='Cluster 2', group=clustergroups[0], type=clustertypes[0], status=ClusterStatusChoices.STATUS_ACTIVE, scope=sites[0]), - Cluster(name='Cluster 3', group=clustergroups[0], type=clustertypes[0], status=ClusterStatusChoices.STATUS_ACTIVE, scope=sites[0]), + Cluster( + name='Cluster 1', + group=clustergroups[0], + type=clustertypes[0], + status=ClusterStatusChoices.STATUS_ACTIVE, + scope=sites[0], + ), + Cluster( + name='Cluster 2', + group=clustergroups[0], + type=clustertypes[0], + status=ClusterStatusChoices.STATUS_ACTIVE, + scope=sites[0], + ), + Cluster( + name='Cluster 3', + group=clustergroups[0], + type=clustertypes[0], + status=ClusterStatusChoices.STATUS_ACTIVE, + scope=sites[0], + ), ) for cluster in clusters: cluster.save() @@ -214,9 +232,30 @@ class VirtualMachineTestCase(ViewTestCases.PrimaryObjectViewTestCase): ) virtual_machines = ( - VirtualMachine(name='Virtual Machine 1', site=sites[0], cluster=clusters[0], device=devices[0], role=roles[0], platform=platforms[0]), - VirtualMachine(name='Virtual Machine 2', site=sites[0], cluster=clusters[0], device=devices[0], role=roles[0], platform=platforms[0]), - VirtualMachine(name='Virtual Machine 3', site=sites[0], cluster=clusters[0], device=devices[0], role=roles[0], platform=platforms[0]), + VirtualMachine( + name='Virtual Machine 1', + site=sites[0], + cluster=clusters[0], + device=devices[0], + role=roles[0], + platform=platforms[0], + ), + VirtualMachine( + name='Virtual Machine 2', + site=sites[0], + cluster=clusters[0], + device=devices[0], + role=roles[0], + platform=platforms[0], + ), + VirtualMachine( + name='Virtual Machine 3', + site=sites[0], + cluster=clusters[0], + device=devices[0], + role=roles[0], + platform=platforms[0], + ), ) VirtualMachine.objects.bulk_create(virtual_machines) diff --git a/netbox/virtualization/views.py b/netbox/virtualization/views.py index 605de0911..ccba12239 100644 --- a/netbox/virtualization/views.py +++ b/netbox/virtualization/views.py @@ -177,7 +177,11 @@ class ClusterView(generic.ObjectView): queryset = Cluster.objects.all() def get_extra_context(self, request, instance): - return instance.virtual_machines.aggregate(vcpus_sum=Sum('vcpus'), memory_sum=Sum('memory'), disk_sum=Sum('disk')) + return instance.virtual_machines.aggregate( + vcpus_sum=Sum('vcpus'), + memory_sum=Sum('memory'), + disk_sum=Sum('disk') + ) @register_model_view(Cluster, 'virtualmachines', path='virtual-machines') diff --git a/netbox/vpn/api/serializers_/crypto.py b/netbox/vpn/api/serializers_/crypto.py index c11b8de2b..fbd04c230 100644 --- a/netbox/vpn/api/serializers_/crypto.py +++ b/netbox/vpn/api/serializers_/crypto.py @@ -74,7 +74,8 @@ class IPSecProposalSerializer(NetBoxModelSerializer): model = IPSecProposal fields = ( 'id', 'url', 'display_url', 'display', 'name', 'description', 'encryption_algorithm', - 'authentication_algorithm', 'sa_lifetime_seconds', 'sa_lifetime_data', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', + 'authentication_algorithm', 'sa_lifetime_seconds', 'sa_lifetime_data', 'comments', 'tags', 'custom_fields', + 'created', 'last_updated', ) brief_fields = ('id', 'url', 'display', 'name', 'description') diff --git a/netbox/vpn/migrations/0005_rename_indexes.py b/netbox/vpn/migrations/0005_rename_indexes.py index 530c39699..f24106c1f 100644 --- a/netbox/vpn/migrations/0005_rename_indexes.py +++ b/netbox/vpn/migrations/0005_rename_indexes.py @@ -8,9 +8,11 @@ class Migration(migrations.Migration): operations = [ # Rename vpn_l2vpn constraints - migrations.RunSQL( - 'ALTER TABLE vpn_l2vpn RENAME CONSTRAINT ipam_l2vpn_tenant_id_bb2564a6_fk_tenancy_tenant_id TO vpn_l2vpn_tenant_id_57ec8f92_fk_tenancy_tenant_id' - ), + migrations.RunSQL(( + 'ALTER TABLE vpn_l2vpn ' + 'RENAME CONSTRAINT ipam_l2vpn_tenant_id_bb2564a6_fk_tenancy_tenant_id ' + 'TO vpn_l2vpn_tenant_id_57ec8f92_fk_tenancy_tenant_id' + )), # Rename ipam_l2vpn_* sequences migrations.RunSQL('ALTER TABLE ipam_l2vpn_export_targets_id_seq RENAME TO vpn_l2vpn_export_targets_id_seq'), migrations.RunSQL('ALTER TABLE ipam_l2vpn_id_seq RENAME TO vpn_l2vpn_id_seq'), @@ -26,22 +28,29 @@ class Migration(migrations.Migration): migrations.RunSQL('ALTER INDEX IF EXISTS ipam_l2vpn_slug_24008406_uniq RENAME TO vpn_l2vpn_slug_76b5a174_uniq'), migrations.RunSQL('ALTER INDEX IF EXISTS ipam_l2vpn_slug_key RENAME TO vpn_l2vpn_slug_key'), # Rename vpn_l2vpntermination constraints - migrations.RunSQL( - 'ALTER TABLE vpn_l2vpntermination RENAME CONSTRAINT ipam_l2vpntermination_assigned_object_id_check TO vpn_l2vpntermination_assigned_object_id_check' - ), - migrations.RunSQL( - 'ALTER TABLE vpn_l2vpntermination RENAME CONSTRAINT ipam_l2vpnterminatio_assigned_object_type_3923c124_fk_django_co TO vpn_l2vpntermination_assigned_object_type_id_f063b865_fk_django_co' - ), - migrations.RunSQL( - 'ALTER TABLE vpn_l2vpntermination RENAME CONSTRAINT ipam_l2vpntermination_l2vpn_id_9e570aa1_fk_ipam_l2vpn_id TO vpn_l2vpntermination_l2vpn_id_f5367bbe_fk_vpn_l2vpn_id' - ), + migrations.RunSQL(( + 'ALTER TABLE vpn_l2vpntermination ' + 'RENAME CONSTRAINT ipam_l2vpntermination_assigned_object_id_check ' + 'TO vpn_l2vpntermination_assigned_object_id_check' + )), + migrations.RunSQL(( + 'ALTER TABLE vpn_l2vpntermination ' + 'RENAME CONSTRAINT ipam_l2vpnterminatio_assigned_object_type_3923c124_fk_django_co ' + 'TO vpn_l2vpntermination_assigned_object_type_id_f063b865_fk_django_co' + )), + migrations.RunSQL(( + 'ALTER TABLE vpn_l2vpntermination ' + 'RENAME CONSTRAINT ipam_l2vpntermination_l2vpn_id_9e570aa1_fk_ipam_l2vpn_id ' + 'TO vpn_l2vpntermination_l2vpn_id_f5367bbe_fk_vpn_l2vpn_id' + )), # Rename ipam_l2vpn_termination_* sequences migrations.RunSQL('ALTER TABLE ipam_l2vpntermination_id_seq RENAME TO vpn_l2vpntermination_id_seq'), # Rename ipam_l2vpn_* indexes migrations.RunSQL('ALTER INDEX ipam_l2vpntermination_pkey RENAME TO vpn_l2vpntermination_pkey'), - migrations.RunSQL( - 'ALTER INDEX ipam_l2vpntermination_assigned_object_type_id_3923c124 RENAME TO vpn_l2vpntermination_assigned_object_type_id_f063b865' - ), + migrations.RunSQL(( + 'ALTER INDEX ipam_l2vpntermination_assigned_object_type_id_3923c124 ' + 'RENAME TO vpn_l2vpntermination_assigned_object_type_id_f063b865' + )), migrations.RunSQL( 'ALTER INDEX ipam_l2vpntermination_l2vpn_id_9e570aa1 RENAME TO vpn_l2vpntermination_l2vpn_id_f5367bbe' ), diff --git a/netbox/wireless/api/serializers_/wirelesslans.py b/netbox/wireless/api/serializers_/wirelesslans.py index 637089277..68f79daf6 100644 --- a/netbox/wireless/api/serializers_/wirelesslans.py +++ b/netbox/wireless/api/serializers_/wirelesslans.py @@ -52,9 +52,9 @@ class WirelessLANSerializer(NetBoxModelSerializer): class Meta: model = WirelessLAN fields = [ - 'id', 'url', 'display_url', 'display', 'ssid', 'description', 'group', 'status', 'vlan', 'scope_type', 'scope_id', 'scope', - 'tenant', 'auth_type', 'auth_cipher', 'auth_psk', 'description', 'comments', 'tags', 'custom_fields', - 'created', 'last_updated', + 'id', 'url', 'display_url', 'display', 'ssid', 'description', 'group', 'status', 'vlan', 'scope_type', + 'scope_id', 'scope', 'tenant', 'auth_type', 'auth_cipher', 'auth_psk', 'description', 'comments', 'tags', + 'custom_fields', 'created', 'last_updated', ] brief_fields = ('id', 'url', 'display', 'ssid', 'description') diff --git a/netbox/wireless/forms/bulk_import.py b/netbox/wireless/forms/bulk_import.py index f23ccf203..1fece7e46 100644 --- a/netbox/wireless/forms/bulk_import.py +++ b/netbox/wireless/forms/bulk_import.py @@ -76,8 +76,8 @@ class WirelessLANImportForm(ScopedImportForm, NetBoxModelImportForm): class Meta: model = WirelessLAN fields = ( - 'ssid', 'group', 'status', 'vlan', 'tenant', 'auth_type', 'auth_cipher', 'auth_psk', 'scope_type', 'scope_id', - 'description', 'comments', 'tags', + 'ssid', 'group', 'status', 'vlan', 'tenant', 'auth_type', 'auth_cipher', 'auth_psk', 'scope_type', + 'scope_id', 'description', 'comments', 'tags', ) labels = { 'scope_id': _('Scope ID'), diff --git a/netbox/wireless/tables/wirelesslan.py b/netbox/wireless/tables/wirelesslan.py index 40f52f8a5..fe9c0f5fa 100644 --- a/netbox/wireless/tables/wirelesslan.py +++ b/netbox/wireless/tables/wirelesslan.py @@ -72,7 +72,8 @@ class WirelessLANTable(TenancyColumnsMixin, NetBoxTable): model = WirelessLAN fields = ( 'pk', 'ssid', 'group', 'status', 'tenant', 'tenant_group', 'vlan', 'interface_count', 'auth_type', - 'auth_cipher', 'auth_psk', 'scope', 'scope_type', 'description', 'comments', 'tags', 'created', 'last_updated', + 'auth_cipher', 'auth_psk', 'scope', 'scope_type', 'description', 'comments', 'tags', 'created', + 'last_updated', ) default_columns = ('pk', 'ssid', 'group', 'status', 'description', 'vlan', 'auth_type', 'interface_count') diff --git a/netbox/wireless/tests/test_filtersets.py b/netbox/wireless/tests/test_filtersets.py index 76ef4e220..27aab83d8 100644 --- a/netbox/wireless/tests/test_filtersets.py +++ b/netbox/wireless/tests/test_filtersets.py @@ -27,8 +27,18 @@ class WirelessLANGroupTestCase(TestCase, ChangeLoggedFilterSetTests): group.save() groups = ( - WirelessLANGroup(name='Wireless LAN Group 1A', slug='wireless-lan-group-1a', parent=parent_groups[0], description='foobar1'), - WirelessLANGroup(name='Wireless LAN Group 1B', slug='wireless-lan-group-1b', parent=parent_groups[0], description='foobar2'), + WirelessLANGroup( + name='Wireless LAN Group 1A', + slug='wireless-lan-group-1a', + parent=parent_groups[0], + description='foobar1', + ), + WirelessLANGroup( + name='Wireless LAN Group 1B', + slug='wireless-lan-group-1b', + parent=parent_groups[0], + description='foobar2', + ), WirelessLANGroup(name='Wireless LAN Group 2A', slug='wireless-lan-group-2a', parent=parent_groups[1]), WirelessLANGroup(name='Wireless LAN Group 2B', slug='wireless-lan-group-2b', parent=parent_groups[1]), WirelessLANGroup(name='Wireless LAN Group 3A', slug='wireless-lan-group-3a', parent=parent_groups[2]), diff --git a/netbox/wireless/tests/test_views.py b/netbox/wireless/tests/test_views.py index 713ba81d7..51af37364 100644 --- a/netbox/wireless/tests/test_views.py +++ b/netbox/wireless/tests/test_views.py @@ -113,9 +113,20 @@ class WirelessLANTestCase(ViewTestCases.PrimaryObjectViewTestCase): cls.csv_data = ( "group,ssid,status,tenant,scope_type,scope_id", - f"Wireless LAN Group 2,WLAN4,{WirelessLANStatusChoices.STATUS_ACTIVE},{tenants[0].name},,", - f"Wireless LAN Group 2,WLAN5,{WirelessLANStatusChoices.STATUS_DISABLED},{tenants[1].name},dcim.site,{sites[0].pk}", - f"Wireless LAN Group 2,WLAN6,{WirelessLANStatusChoices.STATUS_RESERVED},{tenants[2].name},dcim.site,{sites[1].pk}", + "Wireless LAN Group 2,WLAN4,{status},{tenant},,".format( + status=WirelessLANStatusChoices.STATUS_ACTIVE, + tenant=tenants[0].name + ), + "Wireless LAN Group 2,WLAN5,{status},{tenant},dcim.site,{site}".format( + status=WirelessLANStatusChoices.STATUS_DISABLED, + tenant=tenants[1].name, + site=sites[0].pk + ), + "Wireless LAN Group 2,WLAN6,{status},{tenant},dcim.site,{site}".format( + status=WirelessLANStatusChoices.STATUS_RESERVED, + tenant=tenants[2].name, + site=sites[1].pk + ), ) cls.csv_update_data = ( @@ -157,11 +168,17 @@ class WirelessLinkTestCase(ViewTestCases.PrimaryObjectViewTestCase): ] Interface.objects.bulk_create(interfaces) - wirelesslink1 = WirelessLink(interface_a=interfaces[0], interface_b=interfaces[1], ssid='LINK1', tenant=tenants[0]) + wirelesslink1 = WirelessLink( + interface_a=interfaces[0], interface_b=interfaces[1], ssid='LINK1', tenant=tenants[0] + ) wirelesslink1.save() - wirelesslink2 = WirelessLink(interface_a=interfaces[2], interface_b=interfaces[3], ssid='LINK2', tenant=tenants[0]) + wirelesslink2 = WirelessLink( + interface_a=interfaces[2], interface_b=interfaces[3], ssid='LINK2', tenant=tenants[0] + ) wirelesslink2.save() - wirelesslink3 = WirelessLink(interface_a=interfaces[4], interface_b=interfaces[5], ssid='LINK3', tenant=tenants[0]) + wirelesslink3 = WirelessLink( + interface_a=interfaces[4], interface_b=interfaces[5], ssid='LINK3', tenant=tenants[0] + ) wirelesslink3.save() tags = create_tags('Alpha', 'Bravo', 'Charlie')