Skip to content

Commit

Permalink
removed corpNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
vysakh-menon-aot committed Jan 29, 2024
1 parent ece38c7 commit 8ac2081
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/registry_schemas/example_data/schema_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@
},
{
'role': 'amalgamating',
'identifier': '123456',
'legalName': 'Foreign Co.',
'foreignJurisdiction': FOREIGN_JURISDICTION,
'corpNumber': '123456'
'foreignJurisdiction': FOREIGN_JURISDICTION
}
],
'nameRequest': {
Expand Down
29 changes: 11 additions & 18 deletions src/registry_schemas/schemas/amalgamation_application.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,9 @@
"amalgamatingBusinesses": {
"type": "array",
"items": {
"oneOf": [
{
"required": [
"role",
"identifier"
]
},
{
"required": [
"role",
"foreignJurisdiction",
"legalName",
"corpNumber"
]
}
"required": [
"role",
"identifier"
],
"properties": {
"role": {
Expand All @@ -64,10 +52,15 @@
},
"legalName": {
"type": "string"
},
"corpNumber": {
"type": "string"
}
},
"dependencies": {
"foreignJurisdiction": [
"legalName"
],
"legalName": [
"foreignJurisdiction"
]
}
}
},
Expand Down
20 changes: 20 additions & 0 deletions tests/unit/test_amalgamation_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,26 @@ def test_amalgamation_schema_no_amalgamating_businesses():
assert not is_valid


@pytest.mark.parametrize('element', [
('legalName'),
('foreignJurisdiction'),
])
def test_amalgamation_schema_not_valid_foreign(element):
"""Assert not valid if one of the field is not present."""
amalgamation = copy.deepcopy(AMALGAMATION_APPLICATION)
aml_json = {'amalgamationApplication': amalgamation}
del aml_json['amalgamationApplication']['amalgamatingBusinesses'][1][element]

is_valid, errors = validate(aml_json, 'amalgamation_application')

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

assert not is_valid


def test_amalgamation_schema_no_name_request():
"""Assert not valid if nameRequest node is not present."""
amalgamation = copy.deepcopy(AMALGAMATION_APPLICATION)
Expand Down

0 comments on commit 8ac2081

Please sign in to comment.