Skip to content

Commit

Permalink
8438 cooperative schema update (#65)
Browse files Browse the repository at this point in the history
* 8438 cooperative schema update
* removing shared class required since its not available in coop
  • Loading branch information
vysakh-menon-aot authored Aug 13, 2021
1 parent 9a3cab5 commit 6105426
Show file tree
Hide file tree
Showing 10 changed files with 205 additions and 38 deletions.
4 changes: 4 additions & 0 deletions src/registry_schemas/example_data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
COMMENT_FILING,
CONVERSION,
CONVERSION_FILING_TEMPLATE,
COOP_INCORPORATION,
COOP_INCORPORATION_FILING_TEMPLATE,
CORP_CHANGE_OF_ADDRESS,
CORRECTION_AR,
CORRECTION_COA,
Expand Down Expand Up @@ -65,6 +67,8 @@
'CHANGE_OF_NAME',
'COMMENT_BUSINESS',
'COMMENT_FILING',
'COOP_INCORPORATION',
'COOP_INCORPORATION_FILING_TEMPLATE',
'CORP_CHANGE_OF_ADDRESS',
'CORRECTION_AR',
'CORRECTION_COA',
Expand Down
103 changes: 101 additions & 2 deletions src/registry_schemas/example_data/schema_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@
}

CONTACT_POINT = {
'email': '[email protected]',
'phone': '123-456-7890'
'email': '[email protected]',
'phone': '123-456-7890'
}

COMMENT_BUSINESS = {
Expand Down Expand Up @@ -1000,6 +1000,87 @@
}
}

COOP_INCORPORATION = {
'nameRequest': {
'legalType': 'CP'
},
'nameTranslations': [
{'name': 'ABC Ltd.'},
{'name': 'Financière de l’Odet'},
{'name': 'Société Générale'}
],
'offices': {
'registeredOffice': {
'deliveryAddress': {
'streetAddress': 'delivery_address - address line one',
'addressCity': 'delivery_address city',
'addressCountry': 'CA',
'postalCode': 'H0H0H0',
'addressRegion': 'BC'
},
'mailingAddress': {
'streetAddress': 'mailing_address - address line one',
'addressCity': 'mailing_address city',
'addressCountry': 'CA',
'postalCode': 'H0H0H0',
'addressRegion': 'BC',
}
}
},
'parties': [
{
'officer': {
'id': 1,
'firstName': 'Joe',
'lastName': 'Swanson',
'middleName': 'P',
'email': '[email protected]',
'orgName': '',
'partyType': 'person'
},
'mailingAddress': {
'streetAddress': 'mailing_address - address line one',
'streetAddressAdditional': '',
'addressCity': 'mailing_address city',
'addressCountry': 'CA',
'postalCode': 'H0H0H0',
'addressRegion': 'BC'
},
'deliveryAddress': {
'streetAddress': 'delivery_address - address line one',
'streetAddressAdditional': '',
'addressCity': 'delivery_address city',
'addressCountry': 'CA',
'postalCode': 'H0H0H0',
'addressRegion': 'BC'
},
'roles': [
{
'roleType': 'Completing Party',
'appointmentDate': '2018-01-01'

},
{
'roleType': 'Director',
'appointmentDate': '2018-01-01'

}
]
}
],
'contactPoint': {
'email': '[email protected]',
'phone': '123-456-7890'
},
'cooperative': {
'cooperativeAssociationType': 'CP',
'rulesFileKey': 'cooperative/fa00c6bf-eaad-4a07-a3d2-4786ecd6b83b.jpg',
'rulesFileName': 'rule_file.jpg',
'memorandomFileKey': 'cooperative/f722bf16-86be-430d-928d-5529853a3a2c.pdf',
'memorandomFileName': 'memorandom_file.pdf'
}
}

CORRECTION_INCORPORATION = {
'filing': {
'header': {
Expand Down Expand Up @@ -1612,6 +1693,24 @@
}
}

COOP_INCORPORATION_FILING_TEMPLATE = {
'filing': {
'header': {
'name': 'incorporationApplication',
'date': '2019-04-08',
'certifiedBy': 'full name',
'email': '[email protected]',
'filingId': 1,
'effectiveDate': '2019-04-15T00:00:00+00:00'
},
'business': {
'identifier': 'T1234567',
'legalType': 'CP'
},
'incorporationApplication': COOP_INCORPORATION
}
}

ALTERATION_FILING_TEMPLATE = {
'filing': {
'header': {
Expand Down
35 changes: 35 additions & 0 deletions src/registry_schemas/schemas/cooperative.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://bcrs.gov.bc.ca/.well_known/schemas/cooperative",
"type": "object",
"title": "Cooperative Schema",
"required": [
"cooperativeAssociationType",
"rulesFileKey",
"rulesFileName",
"memorandomFileKey",
"memorandomFileName"
],
"properties": {
"cooperativeAssociationType": {
"type": "string",
"title": "The association type for cooperative filing"
},
"rulesFileKey": {
"type": "string",
"title": "The Identifier for rules file in file server"
},
"rulesFileName": {
"type": "string",
"title": "The file name while uploading"
},
"memorandomFileKey": {
"type": "string",
"title": "The Identifier for memorandom file in file server"
},
"memorandomFileName": {
"type": "string",
"title": "The file name while uploading"
}
}
}
10 changes: 5 additions & 5 deletions src/registry_schemas/schemas/incorporation_application.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
"nameRequest",
"offices",
"parties",
"shareStructure",
"contactPoint",
"incorporationAgreement",
"nameTranslations"
"contactPoint"
],
"properties": {
"cooperative": {
"$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/cooperative"
},
"nameRequest": {
"$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/name_request"
},
Expand Down Expand Up @@ -55,4 +55,4 @@
}
}
}
}
}
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.13.1' # pylint: disable=invalid-name
__version__ = '2.14.0' # pylint: disable=invalid-name
1 change: 1 addition & 0 deletions tests/unit/schema_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
('comment.json'),
('contact_point.json'),
('conversion.json'),
('cooperative.json'),
('correction.json'),
('court_order.json'),
('diff.json'),
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/test_alteration.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import pytest

from registry_schemas import validate
from registry_schemas.example_data import ALTERATION, FILING_HEADER
from registry_schemas.example_data import ALTERATION, FILING_HEADER


def test_alteration_schema():
Expand All @@ -33,6 +33,7 @@ def test_alteration_schema():

assert is_valid


def test_filing_alteration_schema():
"""Assert that the JSONSchema validator is working."""
filing = copy.deepcopy(FILING_HEADER)
Expand All @@ -47,6 +48,7 @@ def test_filing_alteration_schema():

assert is_valid


def test_validate_valid_alteration_with_any_required_element():
"""Assert valid if all of the required alterations is present."""
alteration_json = copy.deepcopy(ALTERATION)
Expand Down
13 changes: 13 additions & 0 deletions tests/unit/test_filings.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
CHANGE_OF_DIRECTORS,
CHANGE_OF_DIRECTORS_MAILING,
CONVERSION_FILING_TEMPLATE,
COOP_INCORPORATION_FILING_TEMPLATE,
CORP_CHANGE_OF_ADDRESS,
COURT_ORDER_FILING_TEMPLATE,
FILING_HEADER,
Expand Down Expand Up @@ -371,6 +372,18 @@ def test_incorporation_filing_schema():
assert is_valid


def test_coop_incorporation_filing_schema():
"""Assert that the JSONSchema validator is working."""
is_valid, errors = validate(COOP_INCORPORATION_FILING_TEMPLATE, 'filing')

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

assert is_valid


def test_alteration_filing_schema():
"""Assert that the JSONSchema validator is working."""
is_valid, errors = validate(ALTERATION_FILING_TEMPLATE, 'filing')
Expand Down
Loading

0 comments on commit 6105426

Please sign in to comment.