Skip to content

Commit

Permalink
rename amalgamation to amalgamationApplication
Browse files Browse the repository at this point in the history
Signed-off-by: Hongjing Chen <Hongjing.Chen@gov.bc.ca>
  • Loading branch information
chenhongjing committed Dec 6, 2023
1 parent daac9d1 commit f50348c
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 39 deletions.
2 changes: 1 addition & 1 deletion src/registry_schemas/example_data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
ALL_FILINGS,
ALTERATION,
ALTERATION_FILING_TEMPLATE,
AMALGAMATION,
AMALGAMATION_APPLICATION,
ANNUAL_REPORT,
BEN_CONVERSION,
BUSINESS,
Expand Down
2 changes: 1 addition & 1 deletion src/registry_schemas/example_data/schema_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
'region': 'AB'
}

AMALGAMATION = {
AMALGAMATION_APPLICATION = {
'type': 'regular',
'amalgamatingBusinesses': [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://bcrs.gov.bc.ca/.well_known/schemas/amalgamation",
"$id": "https://bcrs.gov.bc.ca/.well_known/schemas/amalgamation_application",
"type": "object",
"definitions": {},
"title": "Amalgamation Application Schema",
"required": [
"amalgamation"
"amalgamationApplication"
],
"properties": {
"amalgamation": {
"amalgamationApplication": {
"type":"object",
"required": [
"type",
Expand Down
9 changes: 8 additions & 1 deletion src/registry_schemas/schemas/filing.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,11 @@
"properties": {
"name": {
"not": {
"enum": ["registration", "incorporationApplication"]
"enum": [
"registration",
"incorporationApplication",
"amalgamationApplication"
]
}
}
}
Expand All @@ -245,6 +249,9 @@
{
"$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/agm_location_change"
},
{
"$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/amalgamation_application"
},
{
"$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/alteration"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/schema_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
('admin_freeze.json'),
('agm_extension.json'),
('agm_location_change.json'),
('amalgamation.json'),
('amalgamation_application.json'),
('affiliated_businesses.json'),
('agreement_type.json'),
('alteration.json'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
"""Test Suite to ensure amalgamation application schemas are valid."""
import copy
from registry_schemas import validate
from registry_schemas.example_data import AMALGAMATION
from registry_schemas.example_data import AMALGAMATION_APPLICATION


def test_amalgamation_schema():
"""Assert that the JSONSchema validator is working."""
amalgamation = copy.deepcopy(AMALGAMATION)
aml_json = {'amalgamation': amalgamation}
amalgamation = copy.deepcopy(AMALGAMATION_APPLICATION)
aml_json = {'amalgamationApplication': amalgamation}

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

if errors:
for err in errors:
Expand All @@ -34,11 +34,11 @@ def test_amalgamation_schema():

def test_amalgamation_schema_no_type():
"""Assert not valid if type node is not present."""
amalgamation = copy.deepcopy(AMALGAMATION)
aml_json = {'amalgamation': amalgamation}
del aml_json['amalgamation']['type']
amalgamation = copy.deepcopy(AMALGAMATION_APPLICATION)
aml_json = {'amalgamationApplication': amalgamation}
del aml_json['amalgamationApplication']['type']

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

if errors:
for err in errors:
Expand All @@ -50,11 +50,11 @@ def test_amalgamation_schema_no_type():

def test_amalgamation_schema_no_amalgamating_businesses():
"""Assert not valid if amalgamatingBusinesses node is not present."""
amalgamation = copy.deepcopy(AMALGAMATION)
aml_json = {'amalgamation': amalgamation}
del aml_json['amalgamation']['amalgamatingBusinesses']
amalgamation = copy.deepcopy(AMALGAMATION_APPLICATION)
aml_json = {'amalgamationApplication': amalgamation}
del aml_json['amalgamationApplication']['amalgamatingBusinesses']

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

if errors:
for err in errors:
Expand All @@ -66,11 +66,11 @@ def test_amalgamation_schema_no_amalgamating_businesses():

def test_amalgamation_schema_no_name_request():
"""Assert not valid if nameRequest node is not present."""
amalgamation = copy.deepcopy(AMALGAMATION)
aml_json = {'amalgamation': amalgamation}
del aml_json['amalgamation']['nameRequest']
amalgamation = copy.deepcopy(AMALGAMATION_APPLICATION)
aml_json = {'amalgamationApplication': amalgamation}
del aml_json['amalgamationApplication']['nameRequest']

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

if errors:
for err in errors:
Expand All @@ -82,11 +82,11 @@ def test_amalgamation_schema_no_name_request():

def test_amalgamation_schema_no_offices():
"""Assert not valid if the required offices are not present."""
amalgamation = copy.deepcopy(AMALGAMATION)
aml_json = {'amalgamation': amalgamation}
del aml_json['amalgamation']['offices']['registeredOffice']
amalgamation = copy.deepcopy(AMALGAMATION_APPLICATION)
aml_json = {'amalgamationApplication': amalgamation}
del aml_json['amalgamationApplication']['offices']['registeredOffice']

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

if errors:
for err in errors:
Expand All @@ -98,11 +98,11 @@ def test_amalgamation_schema_no_offices():

def test_amalgamation_schema_no_parties():
"""Assert not valid if parties node is not present."""
amalgamation = copy.deepcopy(AMALGAMATION)
aml_json = {'amalgamation': amalgamation}
del aml_json['amalgamation']['parties']
amalgamation = copy.deepcopy(AMALGAMATION_APPLICATION)
aml_json = {'amalgamationApplication': amalgamation}
del aml_json['amalgamationApplication']['parties']

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

if errors:
for err in errors:
Expand All @@ -114,11 +114,11 @@ def test_amalgamation_schema_no_parties():

def test_amalgamation_schema_no_contact():
"""Assert not valid if the required contact info is not present."""
amalgamation = copy.deepcopy(AMALGAMATION)
aml_json = {'amalgamation': amalgamation}
del aml_json['amalgamation']['contactPoint']
amalgamation = copy.deepcopy(AMALGAMATION_APPLICATION)
aml_json = {'amalgamationApplication': amalgamation}
del aml_json['amalgamationApplication']['contactPoint']

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

if errors:
for err in errors:
Expand All @@ -130,11 +130,11 @@ def test_amalgamation_schema_no_contact():

def test_amalgamation_schema_no_court_approval():
"""Assert not valid if courtApproval is not present."""
amalgamation = copy.deepcopy(AMALGAMATION)
aml_json = {'amalgamation': amalgamation}
del aml_json['amalgamation']['courtApproval']
amalgamation = copy.deepcopy(AMALGAMATION_APPLICATION)
aml_json = {'amalgamationApplication': amalgamation}
del aml_json['amalgamationApplication']['courtApproval']

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

if errors:
for err in errors:
Expand Down

0 comments on commit f50348c

Please sign in to comment.