Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MHR API TRANS data validation no mixed party types. #2093

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mhr-api/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mhr-api"
version = "2.0.6"
version = "2.0.7"
description = ""
authors = ["dlovett <[email protected]>"]
license = "BSD 3"
Expand Down
4 changes: 2 additions & 2 deletions mhr-api/src/mhr_api/utils/validator_owner_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
TRANSFER_PARTY_TYPE_INVALID = "Owner party type of administrator, executor, trustee not allowed for this registration. "
TENANCY_PARTY_TYPE_INVALID = "Owner group tenancy type must be NA for executors, trustees, or administrators. "
GROUP_PARTY_TYPE_INVALID = (
"For TRUSTEE, ADMINISTRATOR, or EXECUTOR, all owner party types within the group " + "must be identical. "
"For TRUSTEE, ADMINISTRATOR, or EXECUTOR, all owner party types within the group must be identical. "
)
TRAN_DEATH_GROUP_COUNT = "Only one owner group can be modified in a transfer due to death registration. "
TRAN_DEATH_DELETE_MISSING = "Death transfer excluding owner edits no request deleteOwnerGroups group found. "
Expand Down Expand Up @@ -523,7 +523,7 @@ def validate_owner_party_type( # pylint: disable=too-many-branches
and group.get("type", "") != MhrTenancyTypes.NA
):
error_msg += TENANCY_PARTY_TYPE_INVALID # JOINT scenario
if new and group_parties_invalid:
if group_parties_invalid or (not new and not owner_death and party_count > 0 and party_count != owner_count):
error_msg += GROUP_PARTY_TYPE_INVALID
return error_msg

Expand Down
4 changes: 4 additions & 0 deletions mhr-api/tests/unit/utils/test_transfer_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@
# testdata pattern is ({description}, {valid}, {numerator}, {denominator}, {add_group}, {message content})
TEST_TRANSFER_DATA_GROUP = [
('Valid', True, 1, 2, None, None),
('Invalid party type OWNER', False, 1, 2, EXEC_ADD_GROUPS_INVALID, val_owner_utils.GROUP_PARTY_TYPE_INVALID),
('Invalid party type ADMIN', False, 1, 2, EXEC_ADD_GROUPS_INVALID, val_owner_utils.GROUP_PARTY_TYPE_INVALID),
('Invalid no delete group', False, 1, 2, None, val_owner_utils.DELETE_GROUPS_MISSING),
('Invalid no delete groupId', False, 1, 2, None, val_owner_utils.DELETE_GROUP_ID_MISSING),
('Invalid add TC no owner', False, None, None, TC_GROUP_TRANSFER_ADD2, val_owner_utils.OWNERS_COMMON_INVALID),
Expand Down Expand Up @@ -412,6 +414,8 @@ def test_validate_transfer_group(session, desc, valid, numerator, denominator, a
json_data['addOwnerGroups'][1]['owners'] = []
elif desc == 'Invalid add TC > 1 owner':
json_data['addOwnerGroups'][0]['type'] = 'COMMON'
elif desc == 'Invalid party type ADMIN':
json_data['addOwnerGroups'][0]['owners'][0]['partyType'] = 'ADMINISTRATOR'
else:
for group in json_data.get('addOwnerGroups'):
if not numerator:
Expand Down
Loading