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.
* 23347 notice_of_withdrawal * udpate properties * fix misc * add filingId field * update type * fix test data * remove identifier * add more test
- Loading branch information
Showing
7 changed files
with
119 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
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,25 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "https://bcrs.gov.bc.ca/.well_known/schemas/notice_of_withdrawal", | ||
"type": "object", | ||
"definitions": {}, | ||
"title": "Notice of Withdrawal Filing", | ||
"required": [ | ||
"noticeOfWithdrawal" | ||
], | ||
"properties": { | ||
"noticeOfWithdrawal": { | ||
"type": "object", | ||
"required": [ | ||
"filingId" | ||
], | ||
"properties": { | ||
"filingId": { | ||
"type": "integer", | ||
"title": "IDs for the FED filings." | ||
}, | ||
"courtOrder": { "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/court_order#/properties/courtOrder" } | ||
} | ||
} | ||
} | ||
} |
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,80 @@ | ||
# Copyright © 2024 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 admin freeze on schemas are valid.""" | ||
import copy | ||
|
||
import pytest | ||
|
||
from registry_schemas import validate | ||
from registry_schemas.example_data import FILING_HEADER, NOTICE_OF_WITHDRAWAL | ||
|
||
|
||
def test_minimal_notice_of_withdrawal(): | ||
"""Assert that the JSONSchema validator is working.""" | ||
filing = copy.deepcopy(FILING_HEADER) | ||
filing['filing']['header']['name'] = 'noticeOfWithdrawal' | ||
filing['filing']['noticeOfWithdrawal'] = NOTICE_OF_WITHDRAWAL | ||
|
||
is_valid, errors = validate(filing, 'filing') | ||
|
||
if errors: | ||
for err in errors: | ||
print(err.message) | ||
print(errors) | ||
|
||
assert is_valid | ||
|
||
|
||
def test_notice_of_withdrawal_schema(): | ||
"""Assert that the JSONSchema validator is working.""" | ||
legal_filing = {'noticeOfWithdrawal': NOTICE_OF_WITHDRAWAL} | ||
|
||
is_valid, errors = validate(legal_filing, 'notice_of_withdrawal') | ||
|
||
if errors: | ||
for err in errors: | ||
print(err.message) | ||
print(errors) | ||
|
||
assert is_valid | ||
|
||
|
||
def test_validate_no_filing_id(): | ||
"""Assert not valid if the filingId node is present.""" | ||
legal_filing = {'noticeOfWithdrawal': NOTICE_OF_WITHDRAWAL} | ||
del legal_filing['noticeOfWithdrawal']['filingId'] | ||
|
||
is_valid, errors = validate(legal_filing, 'notice_of_withdrawal') | ||
|
||
if errors: | ||
for err in errors: | ||
print(err.message) | ||
print(errors) | ||
|
||
assert not is_valid | ||
|
||
|
||
def test_invalid_filing_id(): | ||
"""Assert not valid that the filingId node is not integer.""" | ||
legal_filing = {'noticeOfWithdrawal': NOTICE_OF_WITHDRAWAL} | ||
legal_filing['noticeOfWithdrawal']['filingId'] = 'BC2343' | ||
|
||
is_valid, errors = validate(legal_filing, 'notice_of_withdrawal') | ||
|
||
if errors: | ||
for err in errors: | ||
print(err.message) | ||
print(errors) | ||
|
||
assert not is_valid |