Skip to content

Commit

Permalink
11563 registration and changeOfRegistration schema to support busines…
Browse files Browse the repository at this point in the history
…sOffice (#91)
  • Loading branch information
vysakh-menon-aot authored Mar 29, 2022
1 parent 31ba464 commit 7be2b17
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 39 deletions.
60 changes: 32 additions & 28 deletions src/registry_schemas/example_data/schema_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1393,20 +1393,22 @@
'taxId': '123456789',
'identifier': 'TOiakmfuF2'
},
'businessAddress': {
'deliveryAddress': {
'streetAddress': 'delivery_address - address line one',
'addressCity': 'delivery_address city',
'addressCountry': 'Canada',
'postalCode': 'H0H0H0',
'addressRegion': 'BC'
},
'mailingAddress': {
'streetAddress': 'mailing_address - address line one',
'addressCity': 'mailing_address city',
'addressCountry': 'Canada',
'postalCode': 'H0H0H0',
'addressRegion': 'BC'
'offices': {
'businessOffice': {
'deliveryAddress': {
'streetAddress': 'delivery_address - address line one',
'addressCity': 'delivery_address city',
'addressCountry': 'Canada',
'postalCode': 'H0H0H0',
'addressRegion': 'BC'
},
'mailingAddress': {
'streetAddress': 'mailing_address - address line one',
'addressCity': 'mailing_address city',
'addressCountry': 'Canada',
'postalCode': 'H0H0H0',
'addressRegion': 'BC'
}
}
},
'contactPoint': {
Expand Down Expand Up @@ -1493,20 +1495,22 @@
},
'identifier': 'FM1234567'
},
'businessAddress': {
'deliveryAddress': {
'streetAddress': 'delivery_address - address line one',
'addressCity': 'delivery_address city',
'addressCountry': 'Canada',
'postalCode': 'H0H0H0',
'addressRegion': 'BC'
},
'mailingAddress': {
'streetAddress': 'mailing_address - address line one',
'addressCity': 'mailing_address city',
'addressCountry': 'Canada',
'postalCode': 'H0H0H0',
'addressRegion': 'BC'
'offices': {
'businessOffice': {
'deliveryAddress': {
'streetAddress': 'delivery_address - address line one',
'addressCity': 'delivery_address city',
'addressCountry': 'Canada',
'postalCode': 'H0H0H0',
'addressRegion': 'BC'
},
'mailingAddress': {
'streetAddress': 'mailing_address - address line one',
'addressCity': 'mailing_address city',
'addressCountry': 'Canada',
'postalCode': 'H0H0H0',
'addressRegion': 'BC'
}
}
},
'contactPoint': {
Expand Down
11 changes: 8 additions & 3 deletions src/registry_schemas/schemas/change_of_registration.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,21 @@
],
"anyOf": [
{"required": ["business"]},
{"required": ["businessAddress"]},
{"required": ["offices"]},
{"required": ["nameRequest"]},
{"required": ["parties"]}
],
"properties": {
"business": {
"$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/business#/properties/business"
},
"businessAddress": {
"$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/office"
"offices": {
"businessOffice": {
"$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/office"
},
"required": [
"businessOffice"
]
},
"contactPoint": {
"$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/contactPoint"
Expand Down
11 changes: 8 additions & 3 deletions src/registry_schemas/schemas/registration.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"type": "object",
"required": [
"nameRequest",
"businessAddress",
"offices",
"parties",
"contactPoint",
"startDate"
Expand All @@ -21,8 +21,13 @@
"business": {
"$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/business#/properties/business"
},
"businessAddress": {
"$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/office"
"offices": {
"businessOffice": {
"$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/office"
},
"required": [
"businessOffice"
]
},
"businessType": {
"type": "string",
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 @@ -22,4 +22,4 @@
Development release segment: .devN
"""

__version__ = '2.15.20' # pylint: disable=invalid-name
__version__ = '2.15.21' # pylint: disable=invalid-name
5 changes: 2 additions & 3 deletions tests/unit/test_change_of_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_validate_valid_change_of_registration_with_any_required_element():
"""Assert valid if all of the required elements are present."""
change_of_registration_json = copy.deepcopy(CHANGE_OF_REGISTRATION)
del change_of_registration_json['nameRequest']
del change_of_registration_json['businessAddress']
del change_of_registration_json['offices']
del change_of_registration_json['parties']
del change_of_registration_json['courtOrder']
legal_filing = {'changeOfRegistration': change_of_registration_json}
Expand All @@ -71,7 +71,7 @@ def test_validate_invalid_change_of_registration_with_no_required_element():
"""Assert not valid if required elements are not present."""
change_of_registration_json = copy.deepcopy(CHANGE_OF_REGISTRATION)
del change_of_registration_json['nameRequest']
del change_of_registration_json['businessAddress']
del change_of_registration_json['offices']
del change_of_registration_json['parties']
del change_of_registration_json['business']
legal_filing = {'changeOfRegistration': change_of_registration_json}
Expand Down Expand Up @@ -116,4 +116,3 @@ def test_validate_invalid_name_request_change_of_registration():
print(errors)

assert not is_valid

2 changes: 1 addition & 1 deletion tests/unit/test_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def test_validate_valid_registration_with_any_required_element():
@pytest.mark.parametrize('element', [
'contactPoint',
'parties',
'businessAddress',
'offices',
'nameRequest',
'startDate'
])
Expand Down

0 comments on commit 7be2b17

Please sign in to comment.