Skip to content

Replace get_invalid_fields_errors mocks in the /new/ UI tests with factory setup #17444

Description

@jaredlockhart

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions