Skip to content

Commit

Permalink
Dealer remove confirm requirements condition. (#2070)
Browse files Browse the repository at this point in the history
Signed-off-by: Doug Lovett <[email protected]>
  • Loading branch information
doug-lovett authored Nov 21, 2024
1 parent 219a67d commit 4ac265f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 19 deletions.
17 changes: 1 addition & 16 deletions mhr-api/src/mhr_api/utils/registration_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,17 +278,6 @@ def validate_permit(
)
if registration and group_name and group_name == MANUFACTURER_GROUP:
error_msg += validate_manufacturer_permit(registration.mhr_number, json_data, current_location)
# When the group name is DEALERSHIP_GROUP, json_data["qsLocation"] is qualified supplier json.
qs = json_data.get("qsLocation", {})
if (
registration
and group_name
and group_name == DEALERSHIP_GROUP
and qs.get("confirmRequirements", False) == False
and current_location
and current_location.get("locationType", "") != MhrLocationTypes.MANUFACTURER
):
error_msg += MANUFACTURER_DEALER_INVALID
error_msg += validator_utils.validate_draft_state(json_data)
if json_data.get("extension"):
error_msg += validate_permit_extended_tax(json_data, staff)
Expand Down Expand Up @@ -915,11 +904,7 @@ def validate_transfer_dealer(registration: MhrRegistration, json_data, reg_type:
if not json_data.get("supplier"):
error_msg += QS_DEALER_INVALID
return error_msg
qs: dict = json_data.get("supplier")
if qs.get("confirmRequirements", False) == False and not validator_utils.is_valid_dealer_transfer_owner(registration, qs):
error_msg += DEALER_TRANSFER_OWNER_INVALID
if json_data.get("supplier"): # Added just for this validation.
del json_data["supplier"]
del json_data["supplier"]
return error_msg


Expand Down
3 changes: 1 addition & 2 deletions mhr-api/tests/unit/api/test_transfers.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@
('Invalid exempt', '000912', [MHR_ROLE, TRANSFER_SALE_BENEFICIARY], HTTPStatus.BAD_REQUEST, 'PS12345'),
('Invalid historical', '000913', [MHR_ROLE, TRANSFER_SALE_BENEFICIARY], HTTPStatus.BAD_REQUEST, 'PS12345'),
('Invalid non-staff missing declared value', '000900', [MHR_ROLE, TRANSFER_DEATH_JT, TRANSFER_SALE_BENEFICIARY],
HTTPStatus.BAD_REQUEST, 'PS12345'),
('Invalid dealer owner name', '000902', DEALER_ROLES, HTTPStatus.BAD_REQUEST, 'PS12345')
HTTPStatus.BAD_REQUEST, 'PS12345')
]
# testdata pattern is ({description}, {mhr_num}, {roles}, {status}, {account}, {reg_type})
TEST_CREATE_TRANS_DEATH_DATA = [
Expand Down
2 changes: 1 addition & 1 deletion mhr-api/tests/unit/utils/test_permit_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@
('Invalid MANUFACTURER address', False, '000927', None, validator.PERMIT_QS_ADDRESS_MISMATCH, MANUFACTURER_GROUP),
('Invalid MANUFACTURER name', False, '000927', None, validator.PERMIT_MANUFACTURER_NAME_MISMATCH,
MANUFACTURER_GROUP),
('DEALER no existing lot', False, '000919', None, validator.MANUFACTURER_DEALER_INVALID, DEALERSHIP_GROUP),
# ('DEALER no existing lot', False, '000919', None, validator.MANUFACTURER_DEALER_INVALID, DEALERSHIP_GROUP),
('Invalid identical location', False, '000931', LOCATION_000931, validator_utils.LOCATION_INVALID_IDENTICAL,
REQUEST_TRANSPORT_PERMIT)
]
Expand Down

0 comments on commit 4ac265f

Please sign in to comment.