Auth_creds should show the user specified values
Make auth_creds display the user specified credentials which are project_name and username. Normally vim configuration yaml file has no project_id and user_id Change-Id: I987ad7bda04b0a161c56284f77964063490a18e0 Closes-Bug: #1629169
This commit is contained in:
parent
d26d358145
commit
506f4cc4b9
@ -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', '')}
|
||||
|
||||
|
@ -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):
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user