Skip to content

Commit

Permalink
MHR API schema adjust maximum lengths to accommodate manufacturer reg…
Browse files Browse the repository at this point in the history
…istrations. (#55)

Signed-off-by: Doug Lovett <[email protected]>
  • Loading branch information
doug-lovett authored Aug 17, 2023
1 parent fd3bfe7 commit 2818649
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 33 deletions.
8 changes: 4 additions & 4 deletions src/registry_schemas/schemas/mhr/description.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"manufacturer": {
"type": "string",
"minLength": 1,
"maxLength": 65,
"maxLength": 310,
"description": "The manufacturer of the home."
},
"baseInformation": {
Expand Down Expand Up @@ -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."
}
},
Expand Down
10 changes: 5 additions & 5 deletions src/registry_schemas/schemas/mhr/location.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion src/registry_schemas/schemas/mhr/manufacturerInfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"properties": {
"manufacturer": {
"type": "string",
"maxLength": 65,
"maxLength": 310,
"description": "The name of the manufacturer."
}
}
Expand Down
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__ = '1.8.1' # pylint: disable=invalid-name
__version__ = '1.8.2' # pylint: disable=invalid-name
17 changes: 10 additions & 7 deletions tests/unit/mhr/test_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
26 changes: 13 additions & 13 deletions tests/unit/mhr/test_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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})
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/mhr/test_manufacturer_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down

0 comments on commit 2818649

Please sign in to comment.