Merge "Validate uuid-ness in v2 image entity"
This commit is contained in:
commit
5eb7ac1d2e
@ -378,7 +378,8 @@ _BASE_PROPERTIES = {
|
||||
'id': {
|
||||
'type': 'string',
|
||||
'description': 'An identifier for the image',
|
||||
'maxLength': 36,
|
||||
'pattern': ('^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}'
|
||||
'-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$'),
|
||||
},
|
||||
'name': {
|
||||
'type': 'string',
|
||||
|
@ -445,6 +445,12 @@ class TestImagesDeserializer(test_utils.BaseTestCase):
|
||||
expected = {'image': {'properties': {}}}
|
||||
self.assertEqual(expected, output)
|
||||
|
||||
def test_create_invalid_id(self):
|
||||
request = unit_test_utils.get_fake_request()
|
||||
request.body = json.dumps({'id': 'gabe'})
|
||||
self.assertRaises(webob.exc.HTTPBadRequest, self.deserializer.create,
|
||||
request)
|
||||
|
||||
def test_create_no_body(self):
|
||||
request = unit_test_utils.get_fake_request()
|
||||
self.assertRaises(webob.exc.HTTPBadRequest, self.deserializer.create,
|
||||
|
Loading…
Reference in New Issue
Block a user