Expand quick-add regression test coverage #11711

Open
opened 2025-12-29 21:48:53 +01:00 by adam · 0 comments
Owner

Originally created by @jnovinger on GitHub (Oct 9, 2025).

Proposed Changes

The quick-add regression test added in #20542 currently exists only in dcim/tests/test_views.py::MACAddressTestCase::test_create_macaddress_via_quickadd(). This test verifies that MAC addresses can be created via the quick-add modal with proper form prefix handling.

However, the bug fixed in #20542 affected ALL quick-add forms across NetBox, not just MAC addresses. The test coverage should be expanded to prevent similar regressions from affecting other models used as quick-add targets.

Implementation Considerations

Not all models are suitable for generic quick-add testing due to complex validation requirements. Any expansion of test coverage will need to account for this, either by limiting tests to known-working models or by designing tests that verify prefix handling without requiring full form validation success.

Discovered while fixing #20542 (quick-add form prefix bug).

Justification

The prefix bug fixed in #20542 broke quick-add forms in NetBox but went undetected because there were no tests for quick-add functionality.

A single model-specific test provides limited protection. If future changes to ObjectEditView or the quick-add mechanism introduce regressions, they might only be caught if they happen to affect MAC addresses specifically.

Broader test coverage would ensure that the quick-add mechanism remains functional across all models that support it, regardless of which specific form triggers a future regression.

Originally created by @jnovinger on GitHub (Oct 9, 2025). ### Proposed Changes The quick-add regression test added in #20542 currently exists only in `dcim/tests/test_views.py::MACAddressTestCase::test_create_macaddress_via_quickadd()`. This test verifies that MAC addresses can be created via the quick-add modal with proper form prefix handling. However, the bug fixed in #20542 affected ALL quick-add forms across NetBox, not just MAC addresses. The test coverage should be expanded to prevent similar regressions from affecting other models used as quick-add targets. #### Implementation Considerations Not all models are suitable for generic quick-add testing due to complex validation requirements. Any expansion of test coverage will need to account for this, either by limiting tests to known-working models or by designing tests that verify prefix handling without requiring full form validation success. #### Related Issues Discovered while fixing #20542 (quick-add form prefix bug). ### Justification The prefix bug fixed in #20542 broke quick-add forms in NetBox but went undetected because there were no tests for quick-add functionality. A single model-specific test provides limited protection. If future changes to `ObjectEditView` or the quick-add mechanism introduce regressions, they might only be caught if they happen to affect MAC addresses specifically. Broader test coverage would ensure that the quick-add mechanism remains functional across all models that support it, regardless of which specific form triggers a future regression.
adam added the type: housekeepingnetbox labels 2025-12-29 21:48:53 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11711