From 2818649e85eb5beb9ea79a9106cf586f5842d658 Mon Sep 17 00:00:00 2001 From: Doug Lovett Date: Thu, 17 Aug 2023 11:52:49 -0700 Subject: [PATCH] MHR API schema adjust maximum lengths to accommodate manufacturer registrations. (#55) Signed-off-by: Doug Lovett --- .../schemas/mhr/description.json | 8 +++--- .../schemas/mhr/location.json | 10 +++---- .../schemas/mhr/manufacturerInfo.json | 2 +- src/registry_schemas/version.py | 2 +- tests/unit/mhr/test_description.py | 17 +++++++----- tests/unit/mhr/test_location.py | 26 +++++++++---------- tests/unit/mhr/test_manufacturer_info.py | 4 +-- 7 files changed, 36 insertions(+), 33 deletions(-) diff --git a/src/registry_schemas/schemas/mhr/description.json b/src/registry_schemas/schemas/mhr/description.json index ad00f9a..28eeadc 100644 --- a/src/registry_schemas/schemas/mhr/description.json +++ b/src/registry_schemas/schemas/mhr/description.json @@ -7,7 +7,7 @@ "manufacturer": { "type": "string", "minLength": 1, - "maxLength": 65, + "maxLength": 310, "description": "The manufacturer of the home." }, "baseInformation": { @@ -43,17 +43,17 @@ }, "engineerName": { "type": [ "string", "null" ], - "maxLength": 30, + "maxLength": 150, "description": "The name of the engineer who performed the inspection." }, "rebuiltRemarks": { "type": [ "string", "null" ], - "maxLength": 280, + "maxLength": 300, "description": "Comments on the rebuilt status of the home." }, "otherRemarks": { "type": [ "string", "null" ], - "maxLength": 140, + "maxLength": 150, "description": "Other comments on the home." } }, diff --git a/src/registry_schemas/schemas/mhr/location.json b/src/registry_schemas/schemas/mhr/location.json index ce62c0e..6a1547f 100644 --- a/src/registry_schemas/schemas/mhr/location.json +++ b/src/registry_schemas/schemas/mhr/location.json @@ -18,12 +18,12 @@ }, "parkName": { "type": [ "string", "null" ], - "maxLength": 40, + "maxLength": 100, "description": "The name of the location park." }, "pad": { "type": [ "string", "null" ], - "maxLength": 6, + "maxLength": 10, "description": "The location pad (?)." }, "address": { @@ -49,17 +49,17 @@ }, "exceptionPlan": { "type": [ "string", "null" ], - "maxLength": 80, + "maxLength": 150, "description": "Exception plan number or description." }, "dealerName": { "type": [ "string", "null" ], - "maxLength": 60, + "maxLength": 310, "description": "The name of the manufacured home dealer." }, "additionalDescription": { "type": [ "string", "null" ], - "maxLength": 80, + "maxLength": 250, "description": "Additional location information." }, "legalDescription": { diff --git a/src/registry_schemas/schemas/mhr/manufacturerInfo.json b/src/registry_schemas/schemas/mhr/manufacturerInfo.json index 43fefd7..08f076b 100644 --- a/src/registry_schemas/schemas/mhr/manufacturerInfo.json +++ b/src/registry_schemas/schemas/mhr/manufacturerInfo.json @@ -10,7 +10,7 @@ "properties": { "manufacturer": { "type": "string", - "maxLength": 65, + "maxLength": 310, "description": "The name of the manufacturer." } } diff --git a/src/registry_schemas/version.py b/src/registry_schemas/version.py index 75bc034..18c7b47 100644 --- a/src/registry_schemas/version.py +++ b/src/registry_schemas/version.py @@ -22,4 +22,4 @@ Development release segment: .devN """ -__version__ = '1.8.1' # pylint: disable=invalid-name +__version__ = '1.8.2' # pylint: disable=invalid-name diff --git a/tests/unit/mhr/test_description.py b/tests/unit/mhr/test_description.py index 3f5d678..2765684 100644 --- a/tests/unit/mhr/test_description.py +++ b/tests/unit/mhr/test_description.py @@ -20,25 +20,28 @@ from registry_schemas.example_data.mhr import DESCRIPTION +TEXT_60 = '012345678901234567890123456789012345678901234567890123456789' +TEXT_30 = '012345678901234567890123456789' +REBUILT_MAX_LENGTH = TEXT_60 + TEXT_60 + TEXT_60 + TEXT_60 + TEXT_60 +OTHER_MAX_LENGTH = TEXT_60 + TEXT_60 + TEXT_30 +MANUFACTURER_MAX_LENGTH = TEXT_60 + TEXT_60 + TEXT_60 + TEXT_60 + TEXT_60 + '0123456789' +LONG_ENG_NAME = TEXT_60 + TEXT_60 + TEXT_30 # testdata pattern is ({desc}, {valid}, {manu}, {base}, {sc}, {has_s}, {csa_n}, {csa_s}, {eng_date}, {eng_name}) -LONG_MANUFACTURER = '012345678901234567890123456789012345678901234567890123456789012345' -LONG_ENG_NAME = '0123456789012345678901234567890' -LONG_REMARK = '0123456789012345678901234567890123456789012345678901234567890123456789' -REBUILT_MAX_LENGTH = LONG_REMARK + LONG_REMARK + LONG_REMARK + LONG_REMARK -OTHER_MAX_LENGTH = LONG_REMARK + LONG_REMARK TEST_DATA_DESC = [ ('Valid all', True, 'manufacturer', True, 1, True, 'csa num', 'csas', True, 'eng name'), ('Valid no csa', True, 'manufacturer', True, 1, True, None, None, True, 'eng name'), ('Valid no eng', True, 'manufacturer', True, 1, True, 'csa num', 'csas', False, None), + ('Valid eng max length', True, 'manufacturer', True, 1, True, 'csa num', 'csas', False, LONG_ENG_NAME), + ('Valid manu max long', True, MANUFACTURER_MAX_LENGTH, True, 1, True, 'csa num', 'csas', True, 'eng name'), ('Invalid no manufacturer', False, None, True, 1, True, 'csa num', 'csas', True, 'eng name'), ('Invalid no base info', False, 'manufacturer', False, 1, True, 'csa num', 'csas', True, 'eng name'), ('Invalid no section count', False, 'manufacturer', True, None, True, 'csa num', 'csas', True, 'eng name'), ('Invalid no sections', False, 'manufacturer', True, 1, False, 'csa num', 'csas', True, 'eng name'), ('Invalid no csa,eng', False, 'manufacturer', True, 1, True, None, None, False, None), - ('Invalid manu too long', False, LONG_MANUFACTURER, True, 1, True, 'csa num', 'csas', True, 'eng name'), + ('Invalid manu too long', False, MANUFACTURER_MAX_LENGTH + 'X', True, 1, True, 'csa num', 'csas', True, 'eng name'), ('Invalid csa num too long', False, 'manufacturer', True, 1, True, '01234567890', 'csas', True, 'eng name'), ('Invalid csa standard too long', False, 'manufacturer', True, 1, True, '0123456789', '12345', True, 'eng name'), - ('Invalid eng name too long', False, 'manufacturer', True, 1, True, '012345678', 'csas', True, LONG_ENG_NAME) + ('Invalid eng name too long', False, 'manufacturer', True, 1, True, '012345678', 'csas', True, LONG_ENG_NAME + 'X') ] # testdata pattern is ({desc}, {valid}, {rebuilt}, {other}) TEST_REMARKS_DATA_DESC = [ diff --git a/tests/unit/mhr/test_location.py b/tests/unit/mhr/test_location.py index 81ac58f..18f5dc0 100644 --- a/tests/unit/mhr/test_location.py +++ b/tests/unit/mhr/test_location.py @@ -23,10 +23,10 @@ TEXT_20 = '01234567890123456789' TEXT_70 = '0123456789012345678901234567890123456789012345678901234567890123456789' TEXT_80 = '01234567890123456789012345678901234567890123456789012345678901234567890123456789' -LONG_NAME = '01234567890123456789012345678901234567890' -LONG_NAME_MAX = '0123456789012345678901234567890123456789' -DEALER_NAME_MAX = '012345678901234567890123456789012345678901234567890123456789' -DESCRIPTION_MAX = TEXT_80 +PARK_NAME_MAX = TEXT_80 + TEXT_20 +DEALER_NAME_MAX = TEXT_80 + TEXT_70 + TEXT_80 + TEXT_70 + '0123456789' +ADDITIONAL_MAX = TEXT_80 + TEXT_80 + TEXT_80 + '0123456789' +EXCEPTION_MAX = TEXT_80 + TEXT_70 BAND_NAME_MAX = TEXT_70 + TEXT_80 RESERVE_NUMBER_MAX = TEXT_20 VALID_TIMESTAMP = '2022-05-14T21:16:32+00:00' @@ -38,23 +38,23 @@ TEST_DATA_LOCATION = [ ('Valid', True, 'park name', '1234', ADDRESS, None, None, None), ('Valid no park name', True, None, '1234', ADDRESS, None, None, None), - ('Valid no pad', True, LONG_NAME_MAX, None, ADDRESS, None, None, None), + ('Valid no pad', True, PARK_NAME_MAX, None, ADDRESS, None, None, None), ('Valid no pad, park name', True, None, None, ADDRESS, None, None, None), - ('Valid pid', True, LONG_NAME_MAX, None, ADDRESS, '123456789', None, None), - ('Valid tax date', True, LONG_NAME_MAX, None, ADDRESS, '123456789', VALID_TIMESTAMP, None), - ('Valid dealer', True, LONG_NAME_MAX, None, ADDRESS, '123456789', None, DEALER_NAME_MAX), + ('Valid pid', True, PARK_NAME_MAX, None, ADDRESS, '123456789', None, None), + ('Valid tax date', True, PARK_NAME_MAX, None, ADDRESS, '123456789', VALID_TIMESTAMP, None), + ('Valid dealer', True, PARK_NAME_MAX, None, ADDRESS, '123456789', None, DEALER_NAME_MAX), ('Invalid missing address', False, 'org name', '1234', None, None, None, None), - ('Invalid pad too long', False, 'park name', '1234567', ADDRESS, None, None, None), + ('Invalid pad too long', False, 'park name', '01234567890', ADDRESS, None, None, None), ('Invalid pid too long', False, 'park name', '1234', ADDRESS, '0123456789', None, None), ('Invalid dealer too long', False, 'park name', '1234', ADDRESS, None, None, DEALER_NAME_MAX + 'x'), # ('Invalid tax date', False, LONG_NAME_MAX, None, ADDRESS, '123456789', 'invalid format', None), - ('Invalid park name too long', False, LONG_NAME, None, ADDRESS, None, None, None) + ('Invalid park name too long', False, PARK_NAME_MAX + 'X', None, ADDRESS, None, None, None) ] # testdata pattern is ({desc}, {valid}, {exception}, {additional}) TEST_DATA_LOCATION_DESCRIPTIONS = [ - ('Valid both max lengths', True, DESCRIPTION_MAX, DESCRIPTION_MAX), - ('Invalid exception plan too long', False, DESCRIPTION_MAX + 'X', DESCRIPTION_MAX), - ('Invalid additional too long', False, DESCRIPTION_MAX, DESCRIPTION_MAX + 'X') + ('Valid both max lengths', True, EXCEPTION_MAX, ADDITIONAL_MAX), + ('Invalid exception plan too long', False, EXCEPTION_MAX + 'X', ADDITIONAL_MAX), + ('Invalid additional too long', False, EXCEPTION_MAX, ADDITIONAL_MAX + 'X') ] # testdata pattern is ({desc},{valid},{lot},{parcel},{block},{dlot},{part},{section}, # {town},{range},{meridian},{dland},{plan}) diff --git a/tests/unit/mhr/test_manufacturer_info.py b/tests/unit/mhr/test_manufacturer_info.py index 3e345e4..4c6234b 100644 --- a/tests/unit/mhr/test_manufacturer_info.py +++ b/tests/unit/mhr/test_manufacturer_info.py @@ -22,8 +22,8 @@ NAME_50 = '01234567890123456789012345678901234567890123456789' DBA_MAX_LENGTH = NAME_50 + NAME_50 + NAME_50 -DEALER_MAX_LENGTH = '012345678901234567890123456789012345678901234567890123456789' -MANUFACTURER_MAX_LENGTH = '01234567890123456789012345678901234567890123456789012345678901234' +DEALER_MAX_LENGTH = NAME_50 + NAME_50 + NAME_50 + NAME_50 + NAME_50 + NAME_50 + '0123456789' +MANUFACTURER_MAX_LENGTH = DEALER_MAX_LENGTH # testdata pattern is ({desc},{valid},{bcol},{dealer},{has_submitting},{has_owner},{manufacturer},{dba_name}) TEST_DATA_MANUFACTURER = [