summaryrefslogtreecommitdiffstats
path: root/vio
diff options
context:
space:
mode:
authorEthan Lynn <ethanlynnl@vmware.com>2018-03-27 08:20:12 -0700
committerEthan Lynn <ethanlynnl@vmware.com>2018-03-27 08:20:12 -0700
commit94bfa7125d72b557bfe52f919358fd198fb7ce5e (patch)
tree6b0959e85254d16fc611d41c8b8c23c0eb580411 /vio
parent63ff611a184da83941dcea11d1bff0bf1ed0b9e5 (diff)
Add test_get_v3 for TokenView
Add test_get_v3 Change-Id: Id50d7622e56b1e32896e751dfad5e1a7e3ca468e Issue-ID: MULTICLOUD-199 Signed-off-by: Ethan Lynn <ethanlynnl@vmware.com>
Diffstat (limited to 'vio')
-rw-r--r--vio/vio/tests/test_proxy_identity_view.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/vio/vio/tests/test_proxy_identity_view.py b/vio/vio/tests/test_proxy_identity_view.py
index 60986a1..d9364ab 100644
--- a/vio/vio/tests/test_proxy_identity_view.py
+++ b/vio/vio/tests/test_proxy_identity_view.py
@@ -13,6 +13,7 @@
import mock
import unittest
+from vio.pub.msapi import extsys
from vio.swagger.views.proxyplugin.httpclient import BaseClient
from vio.swagger.views.proxyplugin.identity import views
@@ -48,3 +49,27 @@ class TestIdentityServer(unittest.TestCase):
def test_head(self, mock_send):
self.view.head(mock.Mock(), "openstack_regionone", None)
mock_send.assert_called_once()
+
+
+class TestTokenView(unittest.TestCase):
+
+ def setUp(self):
+ self.view = views.TokenView()
+
+ @mock.patch("requests.get")
+ @mock.patch.object(extsys, "get_vim_by_id")
+ def test_get_v3(self, mock_getvim, mock_req):
+ req = mock.Mock()
+ req.get_full_path.return_value = "identity/v3"
+ res = mock.Mock()
+ res.status_code = 200
+ res.json.return_value = {
+ "version": {
+ "links": [{
+ "href": ""
+ }]
+ }
+ }
+ mock_req.return_value = res
+ resp = self.view.get(req, "vmware_nova")
+ self.assertEqual(resp.status_code, 200)