generated from bcgov/bcrs-template-ui
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Conversion filing changes * Alteration schema changes * no message * no message * More tests * Putting back the conversions * Updating description in tests * Changing the version
- Loading branch information
Lekshmi
authored
Jul 6, 2020
1 parent
e6ee574
commit e543cba
Showing
10 changed files
with
339 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -914,6 +914,44 @@ | |
} | ||
|
||
|
||
ALTERATION = { | ||
'provisionsRemoved': False, | ||
'alterCorpType': { | ||
'corpType': 'benefitCompany' | ||
}, | ||
'alterCorpName': { | ||
'legalName': 'new name', | ||
'nrNumber': 'NR123567' | ||
}, | ||
'alterNameTranslations': { | ||
'modifiedTranslations': [{ | ||
'oldValue': 'A1 Ltd.', | ||
'newValue': 'A2 Ltd' | ||
}], | ||
'ceasedTranslations': ['B1', 'B2'] | ||
}, | ||
'alterShareStructure': { | ||
'resolutionDates': ['2020-05-23', '2020-06-01'], | ||
'shareClasses': [{ | ||
'name': 'class1', | ||
'priority': 1, | ||
'maxNumberOfShares': 600, | ||
'parValue': 1, | ||
'currency': 'CAD', | ||
'hasMaximumShares': True, | ||
'hasParValue': True, | ||
'hasRightsOrRestrictions': False, | ||
'series': [{ | ||
'name': 'class1', | ||
'priority': 1, | ||
'maxNumberOfShares': 600, | ||
'hasMaximumShares': True, | ||
'hasRightsOrRestrictions': False | ||
}] | ||
}] | ||
} | ||
} | ||
|
||
CONVERSION = { | ||
'nameRequest': { | ||
'legalType': 'BC' | ||
|
@@ -1069,6 +1107,7 @@ | |
} | ||
} | ||
|
||
|
||
FILING_TEMPLATE = { | ||
'filing': { | ||
'header': { | ||
|
@@ -1109,6 +1148,25 @@ | |
} | ||
} | ||
|
||
ALTERATION_FILING_TEMPLATE = { | ||
'filing': { | ||
'header': { | ||
'name': 'alteration', | ||
'date': '2020-06-25', | ||
'certifiedBy': 'full name', | ||
'email': '[email protected]', | ||
'filingId': 1 | ||
}, | ||
'business': { | ||
'foundingDate': '2018-01-01T00:00:00+00:00', | ||
'identifier': 'U1234567', | ||
'legalName': 'legal name - Test', | ||
'legalType': 'ULC' | ||
}, | ||
'alteration': ALTERATION | ||
} | ||
} | ||
|
||
CONVERSION_FILING_TEMPLATE = { | ||
'filing': { | ||
'header': { | ||
|
@@ -1153,6 +1211,7 @@ | |
('appointReceiver', STUB_FILING), | ||
('continuedOut', STUB_FILING), | ||
('changeOfDirectors', CHANGE_OF_DIRECTORS_MAILING), # bcorp-specific version of filing | ||
('alteration', ALTERATION), | ||
('conversion', CONVERSION) | ||
] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "https://bcrs.gov.bc.ca/.well_known/schemas/alteration", | ||
"anyOf": [ | ||
{"required": ["alterCorpType"]}, | ||
{"required": ["alterCorpName"]}, | ||
{"required": ["alterNameTranslations"]}, | ||
{"required": ["alterShareStructure"]} | ||
], | ||
"type": "object", | ||
"title": "Alteration Filing", | ||
"properties": { | ||
"provisionsRemoved": { | ||
"type": "boolean", | ||
"title": "Has Pre-existing company provisions?" | ||
}, | ||
"alterCorpType": { | ||
"type": "object", | ||
"required": [ | ||
"corpType" | ||
], | ||
"properties": { | ||
"corpType": { | ||
"type": "string", | ||
"title": "Corp type to which the business needs to be converted", | ||
"enum": [ | ||
"benefitCompany" | ||
] | ||
} | ||
} | ||
}, | ||
"alterCorpName": { | ||
"type": "object", | ||
"required": [ | ||
"legalName", | ||
"nrNumber" | ||
], | ||
"properties": { | ||
"legalName": { | ||
"$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/business#/definitions/legalName", | ||
"title": "New Legal Name" | ||
}, | ||
"nrNumber": { | ||
"type": "string", | ||
"maxLength": 10, | ||
"title": "Name Request Number" | ||
} | ||
} | ||
}, | ||
"alterNameTranslations": { | ||
"$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/alteration_name_translations" | ||
}, | ||
"alterShareStructure": { | ||
"type": "object", | ||
"title": "New Share Structure", | ||
"required": [ | ||
"resolutionDates", | ||
"shareClasses" | ||
], | ||
"properties": { | ||
"resolutionDates": { | ||
"type": "array", | ||
"items": { | ||
"type": "string", | ||
"format": "date" | ||
} | ||
}, | ||
"shareClasses": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/share_class#/definitions/shareClass" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
src/registry_schemas/schemas/alteration_name_translations.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "https://bcrs.gov.bc.ca/.well_known/schemas/alteration_name_translations", | ||
"type": "object", | ||
"title": "Change of name translations", | ||
"anyOf": [ | ||
{"required": ["modifiedTranslations"]}, | ||
{"required": ["ceasedTranslations"]} | ||
], | ||
"properties": { | ||
"modifiedTranslations": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"required": [ | ||
"oldValue", | ||
"newValue" | ||
], | ||
"properties": { | ||
"oldValue": { | ||
"type": "string", | ||
"title": "Old Translation" | ||
}, | ||
"newValue": { | ||
"type": "string", | ||
"title": "New Translation" | ||
} | ||
} | ||
} | ||
}, | ||
"ceasedTranslations": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,4 +44,4 @@ | |
"$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/agreementType" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
# Copyright © 2019 Province of British Columbia | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
"""Test Suite to ensure alteration schemas are valid.""" | ||
|
||
import copy | ||
|
||
from registry_schemas import validate | ||
from registry_schemas.example_data import ALTERATION | ||
|
||
|
||
def test_alteration_schema(): | ||
"""Assert that the JSONSchema validator is working.""" | ||
is_valid, errors = validate(ALTERATION, 'alteration') | ||
|
||
if errors: | ||
for err in errors: | ||
print(err.message) | ||
print(errors) | ||
|
||
assert is_valid | ||
|
||
|
||
def test_validate_valid_alteration_with_any_required_element(): | ||
"""Assert valid if any of the required alterations is present.""" | ||
alteration_json = copy.deepcopy(ALTERATION) | ||
del alteration_json['alterCorpName'] | ||
del alteration_json['alterCorpType'] | ||
del alteration_json['alterNameTranslations'] | ||
|
||
is_valid, errors = validate(alteration_json, 'alteration') | ||
|
||
if errors: | ||
for err in errors: | ||
print(err.message) | ||
print(errors) | ||
|
||
assert is_valid | ||
|
||
|
||
def test_validate_invalid_alteration_with_no_required_elements(): | ||
"""Assert not valid if none of the required alterations are present.""" | ||
alteration_json = copy.deepcopy(ALTERATION) | ||
del alteration_json['alterCorpName'] | ||
del alteration_json['alterCorpType'] | ||
del alteration_json['alterNameTranslations'] | ||
del alteration_json['alterShareStructure'] | ||
|
||
is_valid, errors = validate(alteration_json, 'alteration') | ||
|
||
if errors: | ||
for err in errors: | ||
print(err.message) | ||
print(errors) | ||
|
||
assert not is_valid | ||
|
||
|
||
def test_validate_invalid_corp_name_alteration(): | ||
"""Assert not valid if corp name alteration does not contain required elements.""" | ||
alteration_json = copy.deepcopy(ALTERATION) | ||
del alteration_json['alterCorpName']['legalName'] | ||
|
||
is_valid, errors = validate(alteration_json, 'alteration') | ||
|
||
if errors: | ||
for err in errors: | ||
print(err.message) | ||
print(errors) | ||
|
||
assert not is_valid | ||
|
||
|
||
def test_validate_invalid_corp_type_alteration(): | ||
"""Assert not valid if corp type is not valid.""" | ||
alteration_json = copy.deepcopy(ALTERATION) | ||
alteration_json['alterCorpType']['corpType'] = 'ZZ' | ||
|
||
is_valid, errors = validate(alteration_json, 'alteration') | ||
|
||
if errors: | ||
for err in errors: | ||
print(err.message) | ||
print(errors) | ||
|
||
assert not is_valid | ||
|
||
|
||
def test_validate_invalid_name_translation_alteration(): | ||
"""Assert not valid if name translation alteration does not contain mandatory elements.""" | ||
alteration_json = copy.deepcopy(ALTERATION) | ||
del alteration_json['alterNameTranslations']['modifiedTranslations'] | ||
del alteration_json['alterNameTranslations']['ceasedTranslations'] | ||
|
||
is_valid, errors = validate(alteration_json, 'alteration') | ||
|
||
if errors: | ||
for err in errors: | ||
print(err.message) | ||
print(errors) | ||
|
||
assert not is_valid | ||
|
||
|
||
def test_validate_invalid_share_structure_alteration(): | ||
"""Assert not valid if share structure alteration does not contain required elements.""" | ||
alteration_json = copy.deepcopy(ALTERATION) | ||
del alteration_json['alterShareStructure']['shareClasses'] | ||
|
||
is_valid, errors = validate(alteration_json, 'alteration') | ||
|
||
if errors: | ||
for err in errors: | ||
print(err.message) | ||
print(errors) | ||
|
||
assert not is_valid |
Oops, something went wrong.