Skip to content

Commit

Permalink
17796 Allow firm registration for single name user/account (#144)
Browse files Browse the repository at this point in the history
* 17796

Signed-off-by: Hongjing Chen <Hongjing.Chen@gov.bc.ca>

* fix some tests

Signed-off-by: Hongjing Chen <Hongjing.Chen@gov.bc.ca>

* fix-2

Signed-off-by: Hongjing Chen <Hongjing.Chen@gov.bc.ca>

* update version = 2.18.12

Signed-off-by: Hongjing Chen <Hongjing.Chen@gov.bc.ca>

* update required fields

Signed-off-by: Hongjing Chen <Hongjing.Chen@gov.bc.ca>

* fix-3

Signed-off-by: Hongjing Chen <Hongjing.Chen@gov.bc.ca>

* update version=2.18.13

Signed-off-by: Hongjing Chen <Hongjing.Chen@gov.bc.ca>

---------

Signed-off-by: Hongjing Chen <Hongjing.Chen@gov.bc.ca>
  • Loading branch information
chenhongjing committed Oct 11, 2023
1 parent a9fadf7 commit 3b55629
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 3 deletions.
26 changes: 24 additions & 2 deletions src/registry_schemas/schemas/party.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"properties": {
"partyType": { "const": "person" }
},
"required": ["firstName", "lastName"]
"required": ["lastName"]
},
{
"properties": {
Expand Down Expand Up @@ -119,7 +119,29 @@
"officer",
"roles",
"mailingAddress"
]
],
"if": {
"properties":{
"officer": {
"type": "object",
"properties": {
"partyType": { "enum": ["person"] }
},
"required":["partyType"]
}
}
},
"then": {
"properties": {
"officer": {
"type": "object",
"properties": {
"lastName": { "minLength": 1 }
},
"required": ["lastName"]
}
}
}
}
},
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion src/registry_schemas/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
"""


__version__ = '2.18.12' # pylint: disable=invalid-name
__version__ = '2.18.13' # pylint: disable=invalid-name
25 changes: 25 additions & 0 deletions tests/unit/test_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,28 @@ def test_validate_invalid_court_orders(invalid_court_order):
print(errors)

assert not is_valid

@pytest.mark.parametrize(
'first_name, last_name, expected', [
('Joe', 'Swanson', True),
('', 'Swanson', True),
('Joe', '', False),
('', '', False),
('', 'asdfghasdfghasdfghasdfghasdfghasdfgh', False)
]
)
def test_validate_single_name(first_name, last_name, expected):
registration_json = copy.deepcopy(REGISTRATION)
registration_json['parties'][0]['officer']['firstName'] = first_name
registration_json['parties'][0]['officer']['lastName'] = last_name
del registration_json['parties'][0]['roles'][1]
legal_filing = {'registration': registration_json}

is_valid, errors = validate(legal_filing, 'registration')

if errors:
for err in errors:
print(err.message)
print(errors)

assert is_valid == expected

0 comments on commit 3b55629

Please sign in to comment.