Merge "API: restrict length of bay's name to 242"
This commit is contained in:
commit
d20f189dff
|
@ -83,9 +83,10 @@ class Bay(base.APIBase):
|
|||
uuid = types.uuid
|
||||
"""Unique UUID for this bay"""
|
||||
|
||||
name = wtypes.StringType(min_length=1, max_length=255,
|
||||
name = wtypes.StringType(min_length=1, max_length=242,
|
||||
pattern='^[a-zA-Z][a-zA-Z0-9_.-]*$')
|
||||
"""Name of this bay"""
|
||||
"""Name of this bay, max length is limited to 242 because of heat stack
|
||||
requires max length limit to 255, and Magnum amend a uuid length"""
|
||||
|
||||
baymodel_id = wsme.wsproperty(wtypes.text, _get_baymodel_id,
|
||||
_set_baymodel_id, mandatory=True)
|
||||
|
|
|
@ -532,7 +532,7 @@ class TestPost(api_base.FunctionalTest):
|
|||
self.assertEqual(1, response.json['master_count'])
|
||||
|
||||
def test_create_bay_with_invalid_long_name(self):
|
||||
bdict = apiutils.bay_post_data(name='x' * 256)
|
||||
bdict = apiutils.bay_post_data(name='x' * 243)
|
||||
response = self.post_json('/bays', bdict, expect_errors=True)
|
||||
self.assertEqual('application/json', response.content_type)
|
||||
self.assertEqual(400, response.status_int)
|
||||
|
|
Loading…
Reference in New Issue