From 94bfa7125d72b557bfe52f919358fd198fb7ce5e Mon Sep 17 00:00:00 2001 From: Ethan Lynn Date: Tue, 27 Mar 2018 08:20:12 -0700 Subject: Add test_get_v3 for TokenView Add test_get_v3 Change-Id: Id50d7622e56b1e32896e751dfad5e1a7e3ca468e Issue-ID: MULTICLOUD-199 Signed-off-by: Ethan Lynn --- vio/vio/tests/test_proxy_identity_view.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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) -- cgit 1.2.3-korg