diff options
author | Ethan Lynn <ethanlynnl@vmware.com> | 2018-06-13 11:55:41 +0800 |
---|---|---|
committer | Ethan Lynn <ethanlynnl@vmware.com> | 2018-06-13 11:55:41 +0800 |
commit | 4c2d4e407dedc35c381ba71234ab67d30da52ed0 (patch) | |
tree | 354b3d6b714d94eb1aaa6a8350117dee66ed9cdb | |
parent | a73d35d8241aa899afca01470ad444779bbd32f5 (diff) |
Add test_get_vim_session_v2
Add test_get_vim_session_v2
Change-Id: I7f5368dabcb05a54f3362c3eafff4845c1e2709c
Issue-ID: MULTICLOUD-199
Signed-off-by: Ethan Lynn <ethanlynnl@vmware.com>
-rw-r--r-- | vio/vio/tests/test_apiv2_controller.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/vio/vio/tests/test_apiv2_controller.py b/vio/vio/tests/test_apiv2_controller.py new file mode 100644 index 0000000..79182b0 --- /dev/null +++ b/vio/vio/tests/test_apiv2_controller.py @@ -0,0 +1,34 @@ +# Copyright (c) 2018 VMware, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + +import mock +import unittest + +from keystoneauth1.identity import v2 as keystone_v2 + +from vio.api_v2.api_router import controller_builder as cb +from vio.pub.msapi import extsys + + +class TestAPIv2Controller(unittest.TestCase): + + @mock.patch.object(keystone_v2, "Password") + @mock.patch.object(extsys, "get_vim_by_id") + def test_get_vim_session_v2(self, mock_getvim, mock_kv2): + mock_getvim.return_value = { + "url": "http://aa/v2", + "userName": "admin", + "password": "admin", + "domain": "default" + } + mock_kv2.return_value = mock.Mock() + cb._get_vim_auth_session("vmware_vio", "tenant1") |