MPT-17655 Show New account instructions heading on purchase wizard#228
Conversation
📝 WalkthroughWalkthroughThis PR adds three new order-parameter enum members and refactors the validation flow: it makes several helper functions internal, introduces new constraint-checking for new-account parameters (raising AWS002 when violated), updates ACCOUNT_TYPE_CONFIG mappings, and adapts tests to use the new parameter-constraint API. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@swo_aws_extension/flows/validation/base.py`:
- Around line 41-45: The reset_params list for EXISTING_AWS_ENVIRONMENT contains
a duplicate OrderParametersEnum.ORDER_ACCOUNT_NAME.value; update the second
duplicate to OrderParametersEnum.ORDER_ACCOUNT_EMAIL.value so the reset_params
mirror the pattern used in NEW_AWS_ENVIRONMENT — locate the
EXISTING_AWS_ENVIRONMENT definition and replace the duplicate ORDER_ACCOUNT_NAME
entry with ORDER_ACCOUNT_EMAIL in the reset_params array.
In `@tests/flows/validation/Untitled`:
- Line 1: The file "Untitled" contains an orphaned placeholder function name
test_validate_order_orchestrates_all_steps with no code; remove this file from
the PR (delete the file) and ensure there are no remaining imports or references
to test_validate_order_orchestrates_all_steps elsewhere (confirm real tests live
in test_base.py) before committing the change.
🧹 Nitpick comments (2)
tests/flows/validation/test_base.py (2)
40-42: Unused variable assignment.The variable
new_account_instructions_paramis assigned on lines 40-42 but never used before being reassigned on lines 46-48 after callingvalidate_order. This assignment can be removed.♻️ Proposed fix
order = set_order_parameter_constraints( order, OrderParametersEnum.NEW_ACCOUNT_INSTRUCTIONS.value, constraints={"hidden": True, "required": False, "readonly": False}, ) - new_account_instructions_param = get_ordering_parameter( - OrderParametersEnum.NEW_ACCOUNT_INSTRUCTIONS.value, order - ) result = validate_order(mock_client, order)
96-98: Unusedmockerargument.The
mockerfixture is declared as a parameter but not used in this test function, as flagged by static analysis (ARG001).♻️ Proposed fix
def test_validate_order_returns_error_when_new_account_instructions_visible( - order_factory, order_parameters_factory, mocker + order_factory, order_parameters_factory ):
dd7c198 to
7592eb4
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@tests/flows/validation/test_base.py`:
- Around line 96-98: The test function
test_validate_order_returns_error_when_new_account_instructions_visible includes
an unused fixture parameter `mocker`; remove the `mocker` parameter from the
function signature so the test signature matches its usage and avoids
unused-argument warnings (locate and edit the def for
test_validate_order_returns_error_when_new_account_instructions_visible to drop
the `mocker` parameter).
- Around line 40-42: Remove the dead assignment to
new_account_instructions_param: the call to
get_ordering_parameter(OrderParametersEnum.NEW_ACCOUNT_INSTRUCTIONS.value,
order) is unnecessary because new_account_instructions_param is never used
before being overwritten after validate_order; delete that assignment (the
statement that sets new_account_instructions_param) to eliminate the unused
variable and any redundant call.
🧹 Nitpick comments (1)
pyproject.toml (1)
129-129: Potentially redundant per-file-ignore entry.The
WPS210ignore is already covered by the broader rule on line 110 (tests/**/*.py: WPS202 WPS204 WPS210 ...). Thetests/flows/validation/test_base.pyentry only needs to addWPS118since that's not in the broader rule.Consider simplifying to:
- "tests/flows/validation/test_base.py: WPS118 WPS210", + "tests/flows/validation/test_base.py: WPS118",
7592eb4 to
7d51144
Compare
|



Closes MPT-17655