Skip to content

Commit 3354ad7

Browse files
committed
Update test to properly reproduce the bug
- Omit device fields from POST data to match actual bug scenario - Simplify docstring as per review feedback
1 parent 76cb583 commit 3354ad7

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

openwisp_controller/config/tests/test_admin.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2281,18 +2281,19 @@ def test_templates_fetch_queries_10(self):
22812281

22822282
def test_empty_device_form_with_config_inline(self):
22832283
"""
2284-
Test for issue #1057: MultiValueDictKeyError when submitting
2285-
empty device form with configuration inline added
2284+
Ensures submitting device form with missing required fields
2285+
and configuration inline shows validation errors instead of
2286+
raising an exception
22862287
"""
22872288
org = self._get_org()
2289+
template = self._create_template(organization=org)
22882290
path = reverse(f"admin:{self.app_label}_device_add")
2289-
# Submit empty form with config inline
2291+
# Submit form without required device fields but with config inline
2292+
# This reproduces the scenario where user clicks "Add another Configuration"
2293+
# and submits without filling device details
22902294
params = {
2291-
"name": "",
2292-
"mac_address": "",
2293-
"organization": "",
22942295
"config-0-backend": "netjsonconfig.OpenWrt",
2295-
"config-0-templates": "",
2296+
"config-0-templates": str(template.pk),
22962297
"config-0-config": json.dumps({}),
22972298
"config-0-context": "",
22982299
"config-TOTAL_FORMS": 1,

0 commit comments

Comments
 (0)