summaryrefslogtreecommitdiffstats
path: root/newton/newton/proxy
diff options
context:
space:
mode:
authorVictor Morales <victor.morales@intel.com>2018-01-09 14:52:07 -0800
committerVictor Morales <victor.morales@intel.com>2018-01-09 14:52:07 -0800
commitca4927c2d5521ac6cd4f739b5e47fd4259e3c375 (patch)
treea6868e6b002c8d46df4a0b75cbed0b1c18a5779b /newton/newton/proxy
parent7330272e07e7bc3b72bf17cc4eb69ea9584697de (diff)
Add UTs for VimDriverUtils class
The VimDriverUtils class contains utility methods for managing sessions and vim information, as well as others for replacing keys of a dictionary. This change add Unit Tests that validates their correct functionality. Change-Id: Ie569cc995c3e0ebc27f33e4c58652bb0ed34c0a7 Signed-off-by: Victor Morales <victor.morales@intel.com> Issue-ID: MULTICLOUD-83
Diffstat (limited to 'newton/newton/proxy')
-rw-r--r--newton/newton/proxy/views/dnsaasdelegate.py2
-rw-r--r--newton/newton/proxy/views/identityV3.py10
-rw-r--r--newton/newton/proxy/views/services.py2
3 files changed, 8 insertions, 6 deletions
diff --git a/newton/newton/proxy/views/dnsaasdelegate.py b/newton/newton/proxy/views/dnsaasdelegate.py
index 0d2c97e1..9be41ad8 100644
--- a/newton/newton/proxy/views/dnsaasdelegate.py
+++ b/newton/newton/proxy/views/dnsaasdelegate.py
@@ -94,7 +94,7 @@ class DnsaasDelegate(Services):
return Response(data={'error': "vimid %s is not found" % (vimid_delegate)},
status=status.HTTP_404_NOT_FOUND)
- sess = VimDriverUtils.get_session(vim, tenantname=tenant_name, auth_state=None)
+ sess = VimDriverUtils.get_session(vim, tenant_name=tenant_name)
cloud_owner, regionid = extsys.decode_vim_id(vimid_delegate)
interface = 'public'
diff --git a/newton/newton/proxy/views/identityV3.py b/newton/newton/proxy/views/identityV3.py
index d12e24ce..c8141231 100644
--- a/newton/newton/proxy/views/identityV3.py
+++ b/newton/newton/proxy/views/identityV3.py
@@ -91,9 +91,10 @@ class Tokens(APIView):
# prepare request resource to vim instance
vim = VimDriverUtils.get_vim_info(vimid)
- sess = VimDriverUtils.get_session(vim, tenantname = tenant_name, tenantid=tenant_id)
+ sess = VimDriverUtils.get_session(
+ vim, tenant_name=tenant_name, tenant_id=tenant_id)
- tmp_auth_state = VimDriverUtils.get_auth_state(vim, sess)
+ tmp_auth_state = VimDriverUtils.get_auth_state(sess)
tmp_auth_info = json.loads(tmp_auth_state)
tmp_auth_token = tmp_auth_info['auth_token']
tmp_auth_data = tmp_auth_info['body']
@@ -105,8 +106,9 @@ class Tokens(APIView):
tmp_auth_data['token']['catalog'], tmp_metadata_catalog = ProxyUtils.update_catalog(
vimid, tmp_auth_data['token']['catalog'], self.proxy_prefix)
- tmp_auth_token = VimDriverUtils.update_token_cache(
- vim, sess, tmp_auth_token, tmp_auth_state, json.dumps(tmp_metadata_catalog))
+ VimDriverUtils.update_token_cache(
+ tmp_auth_token, tmp_auth_state,
+ json.dumps(tmp_metadata_catalog))
tmp_auth_data['token']['catalog'] = ProxyUtils.update_catalog_dnsaas(
vimid,tmp_auth_data['token']['catalog'], self.proxy_prefix, vim)
diff --git a/newton/newton/proxy/views/services.py b/newton/newton/proxy/views/services.py
index 19fec9ca..11b4bf39 100644
--- a/newton/newton/proxy/views/services.py
+++ b/newton/newton/proxy/views/services.py
@@ -96,7 +96,7 @@ class Services(APIView):
# fetch the auth_state out of cache
auth_state, metadata_catalog = VimDriverUtils.get_token_cache(tmp_auth_token)
req_resource, metadata_catalog = self._get_resource_and_metadata(servicetype, metadata_catalog, requri)
- sess = VimDriverUtils.get_session(vim, tenantid=None, auth_state=auth_state)
+ sess = VimDriverUtils.get_session(vim, auth_state=auth_state)
cloud_owner, regionid = extsys.decode_vim_id(vim_id)
interface = 'public'