Jelajahi Sumber

Fix test_rename_select_all_spans_pages missing field_names

The new "select at least one field" guard fires when rename_fields is set
and no field_names are submitted. Add field_names=['name'] to both the
preview and apply POST data so the test exercises the intended rename path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Brian Tiemann 13 jam lalu
induk
melakukan
fdb5eb142b
1 mengubah file dengan 4 tambahan dan 2 penghapusan
  1. 4 2
      netbox/dcim/tests/test_views.py

+ 4 - 2
netbox/dcim/tests/test_views.py

@@ -3360,7 +3360,7 @@ class InterfaceTestCase(ViewTestCases.DeviceComponentViewTestCase):
         post_url = f'{self._get_url("bulk_rename")}?device_id={get_qs["device_id"]}'
 
         # Preview step: ensure 37 selected (not just one page)
-        data = {'_preview': '1', '_all': '1', 'find': 'eth', 'replace': 'xe'}
+        data = {'_preview': '1', '_all': '1', 'find': 'eth', 'replace': 'xe', 'field_names': ['name']}
         response = self.client.post(post_url, data=data)
         self.assertHttpStatus(response, 200)
         self.assertEqual(len(response.context['selected_objects']), 37)
@@ -3373,7 +3373,9 @@ class InterfaceTestCase(ViewTestCases.DeviceComponentViewTestCase):
         pk_list = [str(pk) for pk in pk_list]
 
         # Apply step: include pk[] in the POST
-        apply_data = {'_apply': '1', '_all': '1', 'find': 'eth', 'replace': 'xe', 'pk': pk_list}
+        apply_data = {
+            '_apply': '1', '_all': '1', 'find': 'eth', 'replace': 'xe', 'pk': pk_list, 'field_names': ['name'],
+        }
         response = self.client.post(post_url, data=apply_data)
 
         # On success the view redirects back to the return URL