The /new/ UI tests patch NimbusExperiment.get_invalid_fields_errors at 22 sites (21 in nimbus_ui/tests/test_new_views.py, 1 class-level patcher in nimbus_ui/tests/test_new_forms.py). This is internal review validation, not external IO, so it should not be mocked. Most sites pass return_value={}, which fabricates "this delivery is review-valid" instead of building one.
Both entry conditions can be built directly with factories:
- Review-valid:
create_with_lifecycle(Lifecycles.CREATED, ...) with firefox_min_version above MIN_REQUIRED_VERSION, is_rollout=True, a single branch, and channels set per application.
- Has review errors: the factory default
firefox_min_version (100) is below MIN_REQUIRED_VERSION (105), so a plain factory rollout already fails validation. Leaving a required field unset also works.
Find the sites with grep -n '"get_invalid_fields_errors"'.
Acceptance criteria:
- No
mock.patch.object(NimbusExperiment, "get_invalid_fields_errors", ...) remains in nimbus_ui/tests/.
- Each affected test sets up its review state with factories and still asserts the same behaviour.
make check passes with 100% coverage.
┆Issue is synchronized with this Jira Task
The
/new/UI tests patchNimbusExperiment.get_invalid_fields_errorsat 22 sites (21 innimbus_ui/tests/test_new_views.py, 1 class-level patcher innimbus_ui/tests/test_new_forms.py). This is internal review validation, not external IO, so it should not be mocked. Most sites passreturn_value={}, which fabricates "this delivery is review-valid" instead of building one.Both entry conditions can be built directly with factories:
create_with_lifecycle(Lifecycles.CREATED, ...)withfirefox_min_versionaboveMIN_REQUIRED_VERSION,is_rollout=True, a single branch, and channels set per application.firefox_min_version(100) is belowMIN_REQUIRED_VERSION(105), so a plain factory rollout already fails validation. Leaving a required field unset also works.Find the sites with
grep -n '"get_invalid_fields_errors"'.Acceptance criteria:
mock.patch.object(NimbusExperiment, "get_invalid_fields_errors", ...)remains innimbus_ui/tests/.make checkpasses with 100% coverage.┆Issue is synchronized with this Jira Task