From f96063a0a7a116cd4018fc621b5bd3f3624fa813 Mon Sep 17 00:00:00 2001 From: Ethan Lynn Date: Wed, 13 Jun 2018 11:57:33 +0800 Subject: Add test_get_vim_session_v3 Add test_get_vim_session_v3 Change-Id: Ifc37d19404cb7165fd2c3675c9f5e53d279f31b0 Issue-ID: MULTICLOUD-199 Signed-off-by: Ethan Lynn --- vio/vio/tests/test_apiv2_controller.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/vio/vio/tests/test_apiv2_controller.py b/vio/vio/tests/test_apiv2_controller.py index 79182b0..c769180 100644 --- a/vio/vio/tests/test_apiv2_controller.py +++ b/vio/vio/tests/test_apiv2_controller.py @@ -14,6 +14,7 @@ import mock import unittest from keystoneauth1.identity import v2 as keystone_v2 +from keystoneauth1.identity import v3 as keystone_v3 from vio.api_v2.api_router import controller_builder as cb from vio.pub.msapi import extsys @@ -32,3 +33,15 @@ class TestAPIv2Controller(unittest.TestCase): } mock_kv2.return_value = mock.Mock() cb._get_vim_auth_session("vmware_vio", "tenant1") + + @mock.patch.object(keystone_v3, "Password") + @mock.patch.object(extsys, "get_vim_by_id") + def test_get_vim_session_v3(self, mock_getvim, mock_kv3): + mock_getvim.return_value = { + "url": "http://aa/v3", + "userName": "admin", + "password": "admin", + "domain": "default" + } + mock_kv3.return_value = mock.Mock() + cb._get_vim_auth_session("vmware_vio", "tenant1") -- cgit 1.2.3-korg