diff --git a/src/registry_schemas/example_data/mhr/schema_data.py b/src/registry_schemas/example_data/mhr/schema_data.py index b0d1103..9de1895 100644 --- a/src/registry_schemas/example_data/mhr/schema_data.py +++ b/src/registry_schemas/example_data/mhr/schema_data.py @@ -250,6 +250,7 @@ NOTE = { 'documentType': 'CONV', 'documentId': 'REG01234', + 'documentRegistrationNumber': '00402332', 'createDateTime': '2018-02-21T18:56:00+00:00', 'expiryDate': '2023-02-22T07:59:00+00:00', 'remarks': '', @@ -600,10 +601,11 @@ }, 'notes': [ { - 'documentType': 'CONV', - 'documentId': 'REG01234', + 'documentType': 'EXRS', + 'documentId': '80035947', + 'documentRegistrationNumber': '00402332', 'createDateTime': '1995-02-21T18:56:00+00:00', - 'remarks': '', + 'remarks': 'HOME IS TO BE USED AS A STORAGE SHED', 'contactName': 'JOHNNY NUCLEO', 'contactAddress': { 'street': '940 BLANSHARD STREET', @@ -783,6 +785,8 @@ 'createDateTime': '2022-10-21T18:56:00+00:00', 'note': { 'documentType': 'REG_103', + 'documentId': '80035947', + 'documentRegistrationNumber': '00402332', 'remarks': 'test', 'expiryDate': '2022-11-21T08:00:00+00:00' }, diff --git a/src/registry_schemas/schemas/mhr/note.json b/src/registry_schemas/schemas/mhr/note.json index d0bb90f..df8e36d 100644 --- a/src/registry_schemas/schemas/mhr/note.json +++ b/src/registry_schemas/schemas/mhr/note.json @@ -13,7 +13,12 @@ "documentId": { "type": "string", "maxLength": 8, - "description": "The unique document ID." + "description": "The unique document ID for the registration associated with the note." + }, + "documentRegistrationNumber": { + "type": [ "string", "null" ], + "maxLength": 8, + "description": "The unique document registration number for the registration associated with the note." }, "createDateTime": { "type": "string", diff --git a/src/registry_schemas/schemas/mhr/registration.json b/src/registry_schemas/schemas/mhr/registration.json index 6f0e54f..237a15c 100644 --- a/src/registry_schemas/schemas/mhr/registration.json +++ b/src/registry_schemas/schemas/mhr/registration.json @@ -34,13 +34,13 @@ "registrationType": { "type": "string", "maxLength": 20, - "enum": ["DECAL_REPLACE", "EXEMPTION_RES", "EXEMPTION_NON_RES", "MHREG", "PERMIT", "PERMIT_EXTENSION", "TRANS", "TRAND"] + "enum": ["DECAL_REPLACE", "EXEMPTION_RES", "EXEMPTION_NON_RES", "MHREG", "PERMIT", "PERMIT_EXTENSION", "TRANS", "TRAND", "TRANS_AFFIDAVIT", "TRANS_ADMIN", "TRANS_WILL"] }, "status": { "type": [ "string", "null" ], "maxLength": 20, - "enum": ["ACTIVE", "DRAFT", "EXEMPT", "HISTORICAL"], - "description": "The status of the registration. ACTIVE - registered; DRAFT; EXEMPT; HISTORICAL - cancelled." + "enum": ["ACTIVE", "DRAFT", "EXEMPT", "FROZEN", "HISTORICAL"], + "description": "The status of the registration. ACTIVE - registered; DRAFT; FROZEN; EXEMPT; HISTORICAL - cancelled. FROZEN is a temporary state where only BC Registries staff can make a change to the manufactured home." }, "clientReferenceId": { "type": [ "string", "null" ], diff --git a/src/registry_schemas/schemas/mhr/registrationSummary.json b/src/registry_schemas/schemas/mhr/registrationSummary.json index f9e74f0..d9ebf98 100644 --- a/src/registry_schemas/schemas/mhr/registrationSummary.json +++ b/src/registry_schemas/schemas/mhr/registrationSummary.json @@ -34,8 +34,8 @@ "statusType": { "type": "string", "maxLength": 20, - "enum": ["ACTIVE", "DRAFT", "EXEMPT", "HISTORICAL"], - "description": "The status of the registration. ACTIVE - registered; DRAFT; EXEMPT; HISTORICAL - cancelled." + "enum": ["ACTIVE", "DRAFT", "EXEMPT", "FROZEN", "HISTORICAL"], + "description": "The status of the registration. ACTIVE - registered; DRAFT; EXEMPT; FROZEN; HISTORICAL - cancelled. FROZEN is a temporary state where only BC Registries staff can make a change to the manufactured home." }, "path": { "type": "string", diff --git a/src/registry_schemas/schemas/mhr/searchSummary.json b/src/registry_schemas/schemas/mhr/searchSummary.json index fe3df39..148ca07 100644 --- a/src/registry_schemas/schemas/mhr/searchSummary.json +++ b/src/registry_schemas/schemas/mhr/searchSummary.json @@ -16,8 +16,8 @@ "status": { "type": "string", "maxLength": 10, - "enum": ["ACTIVE", "EXEMPT", "HISTORICAL", "HISTORIC"], - "description": "The status of a manufactured home registration: one of ACTIVE, EXEMPT, or HISTORICAL. HISTORIC is deprecated (replaced by HISTORICAL)." + "enum": ["ACTIVE", "EXEMPT", "FROZEN", "HISTORICAL"], + "description": "The status of a manufactured home registration: one of ACTIVE, EXEMPT, FROZEN, or HISTORICAL." }, "createDateTime": { "type": "string", diff --git a/src/registry_schemas/version.py b/src/registry_schemas/version.py index eacc169..9e23758 100644 --- a/src/registry_schemas/version.py +++ b/src/registry_schemas/version.py @@ -22,4 +22,4 @@ Development release segment: .devN """ -__version__ = '1.7.3' # pylint: disable=invalid-name +__version__ = '1.7.4' # pylint: disable=invalid-name diff --git a/tests/unit/mhr/test_note.py b/tests/unit/mhr/test_note.py index c46ae2c..b611a80 100644 --- a/tests/unit/mhr/test_note.py +++ b/tests/unit/mhr/test_note.py @@ -29,6 +29,7 @@ ('Valid no address', True, 'type', '123456', True, True, 'remarks', 'contact', None), ('Valid no createTS', True, 'type', '123456', False, True, 'remarks', 'contact', ADDRESS), ('Valid no doc id', True, 'type', None, True, True, 'remarks', 'contact', ADDRESS), + ('Valid no doc_reg num', True, 'type', '123456', True, True, 'remarks', 'contact', ADDRESS), ('Invalid no remarks', False, 'type', '123456', True, True, None, 'contact', ADDRESS), ('Invalid no type', False, None, '123456', True, True, 'remarks', 'contact', ADDRESS), ('Invalid type too long', False, '01234567891', '123456', True, True, 'remarks', 'contact', ADDRESS), @@ -60,6 +61,8 @@ def test_note(desc, valid, type, doc_id, has_create, has_expiry, remarks, contac del data['contactName'] if not address: del data['contactAddress'] + if desc == 'Valid no doc_reg num': + del data['documentRegistrationNumber'] is_valid, errors = validate(data, 'note', 'mhr') diff --git a/tests/unit/mhr/test_registration.py b/tests/unit/mhr/test_registration.py index 66b0319..64595aa 100644 --- a/tests/unit/mhr/test_registration.py +++ b/tests/unit/mhr/test_registration.py @@ -68,7 +68,10 @@ # testdata pattern is ({desc},{valid},{mhr},{status},{rev},{decv},{haso},{hasl},{hasd},{hasn},{hasdt},{hasp}) TEST_DATA_REG = [ ('Valid request', True, None, None, 'ref', 50000, True, True, True, True, False, False), - ('Valid response', True, '003456', 'EXEMPT', 'ref', 50000, True, True, True, True, True, True), + ('Valid response ACTIVE', True, '003456', 'ACTIVE', 'ref', 50000, True, True, True, True, True, True), + ('Valid response EXEMPT', True, '003456', 'EXEMPT', 'ref', 50000, True, True, True, True, True, True), + ('Valid response HISTORICAL', True, '003456', 'HISTORICAL', 'ref', 50000, True, True, True, True, True, True), + ('Valid response FROZEN', True, '003456', 'FROZEN', 'ref', 50000, True, True, True, True, True, True), ('Valid no ref', True, None, None, None, 50000, True, True, True, True, False, False), ('Valid no declared value', True, None, None, 'ref', None, True, True, True, True, False, False), ('Valid no notes', True, None, None, 'ref', 50000, True, True, True, False, False, False), diff --git a/tests/unit/mhr/test_registration_summary.py b/tests/unit/mhr/test_registration_summary.py index 77a778c..7aa2653 100644 --- a/tests/unit/mhr/test_registration_summary.py +++ b/tests/unit/mhr/test_registration_summary.py @@ -36,12 +36,6 @@ 'path': '/mhr/api/v1/registrations/020000', 'createDateTime': '2021-06-03T22:58:45+00:00' } -TEST_INVALID_STATUS_TYPE = { - 'mhrNumber': '020000', - 'statusType': 'X', - 'path': '/mhr/api/v1/registrations/020000', - 'createDateTime': '2021-06-03T22:58:45+00:00' -} TEST_INVALID_MHR_NUMBER = { 'mhrNumber': '2020000', 'statusType': 'ACTIVE', @@ -71,23 +65,28 @@ TEST_EMPTY_JSON = { } -# testdata pattern is ({description}, {is valid}, {data}) +# testdata pattern is ({description}, {is valid}, {data}, {status}) TEST_DATA = [ - ('All valid', True, TEST_VALID_ALL), - ('Minimum valid', True, TEST_VALID_MINIMUM), - ('Invalid status type', False, TEST_INVALID_STATUS_TYPE), - ('Invalid mhr number length', False, TEST_INVALID_MHR_NUMBER), - ('Invalid missing mhr num', False, TEST_INVALID_MISSING_MHR_NUMBER), - ('Invalid missing status', False, TEST_INVALID_MISSING_STATUS), - ('Invalid missing path', False, TEST_INVALID_MISSING_PATH), - ('Invalid missing create_ts', False, TEST_INVALID_MISSING_CREATE_TS), - ('No settings', False, TEST_EMPTY_JSON) + ('All valid', True, TEST_VALID_ALL, 'ACTIVE'), + ('Minimum valid', True, TEST_VALID_MINIMUM, 'ACTIVE'), + ('Valid EXEMPT', True, TEST_VALID_MINIMUM, 'EXEMPT'), + ('Valid HISTORICAL', True, TEST_VALID_MINIMUM, 'HISTORICAL'), + ('Valid FROZEN', True, TEST_VALID_MINIMUM, 'FROZEN'), + ('Invalid status type', False, TEST_VALID_MINIMUM, 'X'), + ('Invalid mhr number length', False, TEST_INVALID_MHR_NUMBER, 'ACTIVE'), + ('Invalid missing mhr num', False, TEST_INVALID_MISSING_MHR_NUMBER, 'ACTIVE'), + ('Invalid missing status', False, TEST_INVALID_MISSING_STATUS, None), + ('Invalid missing path', False, TEST_INVALID_MISSING_PATH, 'ACTIVE'), + ('Invalid missing create_ts', False, TEST_INVALID_MISSING_CREATE_TS, 'ACTIVE'), + ('No settings', False, TEST_EMPTY_JSON, None) ] -@pytest.mark.parametrize('desc,valid,data', TEST_DATA) -def test_registration_summary(desc, valid, data): +@pytest.mark.parametrize('desc,valid,data,status', TEST_DATA) +def test_registration_summary(desc, valid, data, status): """Assert that the schema is performing as expected for a registration summary.""" + if status: + data['statusType'] = status is_valid, errors = validate(data, 'registrationSummary', 'mhr') if errors: diff --git a/tests/unit/mhr/test_search_summary.py b/tests/unit/mhr/test_search_summary.py index 9446bba..2cc9563 100644 --- a/tests/unit/mhr/test_search_summary.py +++ b/tests/unit/mhr/test_search_summary.py @@ -59,7 +59,7 @@ ('ACTIVE', True), ('EXEMPT', True), ('HISTORICAL', True), - ('HISTORIC', True), + ('FROZEN', True), ('XX', False) ] # testdata pattern is ({is valid}, {has_mrh}, {has_status}, {has_base})