Merge "Validate type parameter for empty string"
This commit is contained in:
commit
5d142c08da
@ -294,7 +294,7 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||
'type': {
|
||||
'allow_post': True,
|
||||
'allow_put': False,
|
||||
'validate': {'type:string': None},
|
||||
'validate': {'type:not_empty_string': None},
|
||||
'is_visible': True
|
||||
},
|
||||
'auth_url': {
|
||||
|
@ -126,3 +126,14 @@ class VIMCreateTestCase(base.TestCase):
|
||||
self.controller.create,
|
||||
request, vim_dict)
|
||||
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('updated_at', res)
|
||||
self.assertEqual(False, res['is_default'])
|
||||
self.assertEqual('openstack', res['type'])
|
||||
|
||||
def test_delete_vim(self):
|
||||
self._insert_dummy_vim()
|
||||
|
Loading…
Reference in New Issue
Block a user