Merge "Auth_creds should show the user specified values"

This commit is contained in:
Jenkins 2017-05-29 05:05:35 +00:00 committed by Gerrit Code Review
commit ed54224b6f
3 changed files with 9 additions and 13 deletions

View File

@ -24,17 +24,15 @@ def args2body_vim(config_param, vim):
:param vim: vim request object
:return: vim body with args populated
"""
vim['vim_project'] = {'id': config_param.pop('project_id', ''),
'name': config_param.pop('project_name', ''),
vim['vim_project'] = {'name': config_param.pop('project_name', ''),
'project_domain_name':
config_param.pop('project_domain_name', '')}
if not vim['vim_project']['id'] and not vim['vim_project']['name']:
raise exceptions.TackerClientException(message='Project Id or name '
if not vim['vim_project']['name']:
raise exceptions.TackerClientException(message='Project name '
'must be specified',
status_code=404)
vim['auth_cred'] = {'username': config_param.pop('username', ''),
'password': config_param.pop('password', ''),
'user_id': config_param.pop('user_id', ''),
'user_domain_name':
config_param.pop('user_domain_name', '')}

View File

@ -35,10 +35,10 @@ class CLITestV10VIMJSON(test_cli10.CLITestV10Base):
plurals = {'vims': 'vim'}
super(CLITestV10VIMJSON, self).setUp(plurals=plurals)
self.vim_project = {
'name': 'abc', 'id': '',
'name': 'abc',
'project_domain_name': 'prj_domain_name'}
self.auth_cred = {'username': 'xyz', 'password': '12345', 'user_id':
'', 'user_domain_name': 'user_domain_name'}
self.auth_cred = {'username': 'xyz', 'password': '12345',
'user_domain_name': 'user_domain_name'}
self.auth_url = 'http://1.2.3.4:5000'
def test_register_vim_all_params(self):

View File

@ -24,20 +24,18 @@ from tackerclient.tacker.v1_0.nfvo import vim_utils
class TestVIMUtils(testtools.TestCase):
def test_args2body_vim(self):
config_param = {'project_id': sentinel.prj_id1,
config_param = {'project_name': sentinel.prj_name,
'username': sentinel.usrname1,
'password': sentinel.password1,
'project_domain_name': sentinel.prj_domain_name1,
'user_domain_name': sentinel.user_domain.name, }
vim = {}
auth_cred = config_param.copy()
auth_cred.pop('project_id')
auth_cred.pop('project_name')
auth_cred.pop('project_domain_name')
auth_cred.update({'user_id': ''})
expected_vim = {'auth_cred': auth_cred,
'vim_project':
{'id': sentinel.prj_id1,
'name': '',
{'name': sentinel.prj_name,
'project_domain_name': sentinel.prj_domain_name1}}
vim_utils.args2body_vim(config_param.copy(), vim)
self.assertEqual(expected_vim, vim)