1 # Copyright (c) 2018 Amdocs
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at:
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 from multicloud_azure.pub.utils import restcall
19 class TestAAIClient(unittest.TestCase):
22 self.view = restcall.AAIClient("vmware", "4.0")
24 @mock.patch.object(restcall, "call_req")
25 def test_get_vim(self, mock_call):
26 mock_call.return_value = [0, '{"cloudOwner": "vmware"}']
27 ret = self.view.get_vim(get_all=True)
28 expect_ret = {"cloudOwner": "vmware"}
29 self.assertEqual(expect_ret, ret)
31 @mock.patch.object(restcall.AAIClient, "get_vim")
32 @mock.patch.object(restcall, "call_req")
33 def test_update_identity_url(self, mock_call, mock_getvim):
34 mock_getvim.return_value = {}
35 self.view.update_identity_url()
36 mock_call.assert_called_once()
38 @mock.patch.object(restcall, "call_req")
39 def test_add_flavors(self, mock_call):
50 "links": [{"href": "http://fake-url"}],
54 self.view.add_flavors(flavors)
55 mock_call.assert_called_once()
57 @mock.patch.object(restcall, "call_req")
58 def test_add_flavors_with_hpa(self, mock_call):
69 "links": [{"href": "http://fake-url"}],
74 self.view._get_ovsdpdk_capabilities = mock.MagicMock()
75 self.view._get_ovsdpdk_capabilities.return_value = {}
76 self.view.add_flavors(flavors)
77 mock_call.assert_called_once()