mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-18 19:32:24 -06:00
Closes #17752: Rename URL paths for bulk import to *_bulk_import
This commit is contained in:
@@ -158,7 +158,7 @@ def add_button(model, action='add'):
|
||||
|
||||
|
||||
@register.inclusion_tag('buttons/import.html')
|
||||
def import_button(model, action='import'):
|
||||
def import_button(model, action='bulk_import'):
|
||||
try:
|
||||
url = reverse(get_viewname(model, action))
|
||||
except NoReverseMatch:
|
||||
|
||||
@@ -594,10 +594,10 @@ class ViewTestCases:
|
||||
|
||||
# Test GET without permission
|
||||
with disable_warnings('django.request'):
|
||||
self.assertHttpStatus(self.client.get(self._get_url('import')), 403)
|
||||
self.assertHttpStatus(self.client.get(self._get_url('bulk_import')), 403)
|
||||
|
||||
# Try POST without permission
|
||||
response = self.client.post(self._get_url('import'), data)
|
||||
response = self.client.post(self._get_url('bulk_import'), data)
|
||||
with disable_warnings('django.request'):
|
||||
self.assertHttpStatus(response, 403)
|
||||
|
||||
@@ -620,10 +620,10 @@ class ViewTestCases:
|
||||
obj_perm.object_types.add(ObjectType.objects.get_for_model(self.model))
|
||||
|
||||
# Try GET with model-level permission
|
||||
self.assertHttpStatus(self.client.get(self._get_url('import')), 200)
|
||||
self.assertHttpStatus(self.client.get(self._get_url('bulk_import')), 200)
|
||||
|
||||
# Test POST with permission
|
||||
self.assertHttpStatus(self.client.post(self._get_url('import'), data), 302)
|
||||
self.assertHttpStatus(self.client.post(self._get_url('bulk_import'), data), 302)
|
||||
self.assertEqual(self._get_queryset().count(), initial_count + len(self.csv_data) - 1)
|
||||
|
||||
@override_settings(EXEMPT_VIEW_PERMISSIONS=['*'])
|
||||
@@ -649,7 +649,7 @@ class ViewTestCases:
|
||||
obj_perm.object_types.add(ObjectType.objects.get_for_model(self.model))
|
||||
|
||||
# Test POST with permission
|
||||
self.assertHttpStatus(self.client.post(self._get_url('import'), data), 302)
|
||||
self.assertHttpStatus(self.client.post(self._get_url('bulk_import'), data), 302)
|
||||
self.assertEqual(initial_count, self._get_queryset().count())
|
||||
|
||||
reader = csv.DictReader(array, delimiter=',')
|
||||
@@ -684,7 +684,7 @@ class ViewTestCases:
|
||||
obj_perm.object_types.add(ObjectType.objects.get_for_model(self.model))
|
||||
|
||||
# Attempt to import non-permitted objects
|
||||
self.assertHttpStatus(self.client.post(self._get_url('import'), data), 200)
|
||||
self.assertHttpStatus(self.client.post(self._get_url('bulk_import'), data), 200)
|
||||
self.assertEqual(self._get_queryset().count(), initial_count)
|
||||
|
||||
# Update permission constraints
|
||||
@@ -692,7 +692,7 @@ class ViewTestCases:
|
||||
obj_perm.save()
|
||||
|
||||
# Import permitted objects
|
||||
self.assertHttpStatus(self.client.post(self._get_url('import'), data), 302)
|
||||
self.assertHttpStatus(self.client.post(self._get_url('bulk_import'), data), 302)
|
||||
self.assertEqual(self._get_queryset().count(), initial_count + len(self.csv_data) - 1)
|
||||
|
||||
class BulkEditObjectsViewTestCase(ModelViewTestCase):
|
||||
|
||||
Reference in New Issue
Block a user