Skip to content

Commit

Permalink
Merge pull request #54 from andrepestana-aot/6415_Schema-Add_Court_Or…
Browse files Browse the repository at this point in the history
…der_and_Plan_of_Arrangement

6415 - Add Court Order and Plan of Arrangement
  • Loading branch information
thorwolpert authored Mar 15, 2021
2 parents 09e8820 + 12a6cd5 commit 03074fa
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/registry_schemas/example_data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
CORRECTION_COD,
CORRECTION_COMBINED_AR,
CORRECTION_INCORPORATION,
COURT_ORDER,
FILING_HEADER,
FILING_TEMPLATE,
FILINGS_WITH_TYPES,
Expand Down Expand Up @@ -64,6 +65,7 @@
'CORRECTION_COD',
'CORRECTION_COMBINED_AR',
'CORRECTION_INCORPORATION',
'COURT_ORDER',
'FILING_HEADER',
'FILING_TEMPLATE',
'FILINGS_WITH_TYPES',
Expand Down
9 changes: 8 additions & 1 deletion src/registry_schemas/example_data/schema_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,12 @@
}
}

COURT_ORDER = {
'fileNumber': '#1234-5678/90',
'orderDate': '2021-01-30T09:56:01+08:00',
'effectOfOrder': 'Order to disclose financial data'
}

ALTERATION = {
'provisionsRemoved': False,
'business': {
Expand Down Expand Up @@ -1156,7 +1162,8 @@
},
'contactPoint': {
'email': '[email protected]'
}
},
'courtOrder': COURT_ORDER
}

CONVERSION = {
Expand Down
3 changes: 3 additions & 0 deletions src/registry_schemas/schemas/alteration.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
},
"shareStructure": {
"$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/share_structure"
},
"courtOrder": {
"$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/court_order"
}
}
}
31 changes: 31 additions & 0 deletions src/registry_schemas/schemas/court_order.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://bcrs.gov.bc.ca/.well_known/schemas/court_order",
"type": "object",
"title": "Court Order Information Schema",
"properties": {
"fileNumber": {
"type": "string",
"minLength": 5,
"maxLength": 20,
"description": "The court assigns each court order a unique file number up to 20 characters in length."
},
"orderDate": {
"type": "string",
"description": "The date and time of the court order.",
"format": "date-time",
"examples": ["1970-01-01T00:00:00+00:00"]
},
"effectOfOrder": {
"type": "string",
"minLength": 5,
"maxLength": 500,
"description": "A brief note to explain the purpose of the Court Order."
}
},
"required": [
"fileNumber",
"orderDate"
]
}
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.11.2' # pylint: disable=invalid-name
__version__ = '2.11.3' # pylint: disable=invalid-name
3 changes: 2 additions & 1 deletion tests/unit/schema_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@
('name_translations.json'),
('conversion.json'),
('transition.json'),
('diff.json')
('diff.json'),
('court_order.json')
]
44 changes: 44 additions & 0 deletions tests/unit/test_alteration.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

import copy

import pytest

from registry_schemas import validate
from registry_schemas.example_data import ALTERATION

Expand Down Expand Up @@ -136,3 +138,45 @@ def test_validate_invalid_share_structure_alteration():
print(errors)

assert not is_valid


@pytest.mark.parametrize('invalid_court_order', [
*[{'orderDate': '2021-01-30T09:56:01+08:00'}],
*[{'fileNumber': '12345'}],
*[{
'fileNumber': invalid_file_number,
'orderDate': '2021-01-30T09:56:01+08:00'
} for invalid_file_number in ['1234', '123456789012345678901']],
*[{
'fileNumber': '12345',
'orderDate': invalid_order_date
} for invalid_order_date in ['2021-01-30T09:56:01', '2021-01-30']],
*[{
'fileNumber': '12345',
'orderDate': '2021-01-30T09:56:01+08:00',
'effectOfOrder': invalid_effect_of_order
} for invalid_effect_of_order in ['abcd', ('01234567890123456789012345678901234567890123456789'
'01234567890123456789012345678901234567890123456789'
'01234567890123456789012345678901234567890123456789'
'01234567890123456789012345678901234567890123456789'
'01234567890123456789012345678901234567890123456789'
'01234567890123456789012345678901234567890123456789'
'01234567890123456789012345678901234567890123456789'
'01234567890123456789012345678901234567890123456789'
'01234567890123456789012345678901234567890123456789'
'012345678901234567890123456789012345678901234567890')]
]
])
def test_validate_invalid_court_orders(invalid_court_order):
"""Assert not valid court orders."""
alteration_json = copy.deepcopy(ALTERATION)
alteration_json['courtOrder'] = invalid_court_order

is_valid, errors = validate(alteration_json, 'alteration')

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

assert not is_valid

0 comments on commit 03074fa

Please sign in to comment.