From 4723b5d862ca70adfed4eea05c4bd32074509746 Mon Sep 17 00:00:00 2001 From: Ethan Lynn Date: Tue, 27 Mar 2018 11:28:26 -0700 Subject: Add test_get_v2 for TokenV2View Add test_get_v2 Change-Id: I2b22bd8fac30fe98d791162ed200d41697602c3b Issue-ID: MULTICLOUD-199 Signed-off-by: Ethan Lynn --- vio/vio/tests/test_proxy_identity_view.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'vio') diff --git a/vio/vio/tests/test_proxy_identity_view.py b/vio/vio/tests/test_proxy_identity_view.py index 19b77de..e7b1e15 100644 --- a/vio/vio/tests/test_proxy_identity_view.py +++ b/vio/vio/tests/test_proxy_identity_view.py @@ -168,3 +168,30 @@ class TestTokenView(unittest.TestCase): mock_post.return_value = res resp = self.view.post(req, "vmware_nova") self.assertEqual(200, resp.status_code) + + +class TestTokenV2View(unittest.TestCase): + + def setUp(self): + self.view = views.TokenV2View() + + @mock.patch("requests.get") + @mock.patch.object(extsys, "get_vim_by_id") + def test_get_v2(self, mock_getvim, mock_get): + req = mock.Mock() + req.get_full_path.return_value = "identity/v2.0" + mock_getvim.return_value = { + "url": "http://onap.org/identity/v3" + } + res = mock.Mock() + res.status_code = 200 + res.json.return_value = { + "version": { + "links": [{ + "href": "" + }] + } + } + mock_get.return_value = res + resp = self.view.get(req, "vmware_nova") + self.assertEqual(resp.status_code, 200) -- cgit 1.2.3-korg