Merge "Validate type parameter for empty string"
This commit is contained in:
commit
5d142c08da
@ -294,7 +294,7 @@ RESOURCE_ATTRIBUTE_MAP = {
|
|||||||
'type': {
|
'type': {
|
||||||
'allow_post': True,
|
'allow_post': True,
|
||||||
'allow_put': False,
|
'allow_put': False,
|
||||||
'validate': {'type:string': None},
|
'validate': {'type:not_empty_string': None},
|
||||||
'is_visible': True
|
'is_visible': True
|
||||||
},
|
},
|
||||||
'auth_url': {
|
'auth_url': {
|
||||||
|
@ -126,3 +126,14 @@ class VIMCreateTestCase(base.TestCase):
|
|||||||
self.controller.create,
|
self.controller.create,
|
||||||
request, vim_dict)
|
request, vim_dict)
|
||||||
self.assertEqual(msg, six.text_type(exp))
|
self.assertEqual(msg, six.text_type(exp))
|
||||||
|
|
||||||
|
@ddt.data("", " ", None, 123)
|
||||||
|
def test_create_vim_with_invalid_type(self, value):
|
||||||
|
vim_dict = get_vim_config()
|
||||||
|
vim_dict['vim']['type'] = value
|
||||||
|
request = wsgi.Request.blank("/vims.json", method='POST',
|
||||||
|
headers={'Content-Type': "application/json"})
|
||||||
|
request.environ['tacker.context'] = self.fake_admin_context()
|
||||||
|
self.assertRaises(exc.HTTPBadRequest,
|
||||||
|
self.controller.create,
|
||||||
|
request, vim_dict)
|
||||||
|
@ -302,6 +302,7 @@ class TestNfvoPlugin(db_base.SqlTestCase):
|
|||||||
self.assertIn('created_at', res)
|
self.assertIn('created_at', res)
|
||||||
self.assertIn('updated_at', res)
|
self.assertIn('updated_at', res)
|
||||||
self.assertEqual(False, res['is_default'])
|
self.assertEqual(False, res['is_default'])
|
||||||
|
self.assertEqual('openstack', res['type'])
|
||||||
|
|
||||||
def test_delete_vim(self):
|
def test_delete_vim(self):
|
||||||
self._insert_dummy_vim()
|
self._insert_dummy_vim()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user