diff options
author | Ethan Lynn <ethanlynnl@vmware.com> | 2018-03-27 07:32:19 -0700 |
---|---|---|
committer | Ethan Lynn <ethanlynnl@vmware.com> | 2018-03-27 07:32:19 -0700 |
commit | 639dfd7c03650562b7e9d6cc8e1bf69fe11bbadc (patch) | |
tree | f10d6eb6c6c3d59d730792a8148614b3ea2d848a | |
parent | b843c0542c11d3631044ad3aedf9a93e1dfffa07 (diff) |
Add test_get_res_from_aai
Add test_get_res_from_aai
Change-Id: I18927e05b1a75aeb99a11d9a6400e3ae563213b8
Issue-ID: MULTICLOUD-199
Signed-off-by: Ethan Lynn <ethanlynnl@vmware.com>
-rw-r--r-- | vio/vio/tests/test_restcall.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/vio/vio/tests/test_restcall.py b/vio/vio/tests/test_restcall.py index 5baf83e..80e9ef3 100644 --- a/vio/vio/tests/test_restcall.py +++ b/vio/vio/tests/test_restcall.py @@ -8,6 +8,7 @@ # 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 vio.pub.utils import restcall @@ -22,3 +23,21 @@ class TestRestCall(unittest.TestCase): expected = "http://a.com/test/resource" for i in range(len(url)): self.assertEqual(expected, restcall.combine_url(url[i], res[i])) + + @mock.patch.object(restcall, "call_req") + def test_get_res_from_aai(self, mock_call): + res = "cloud-regions" + content = "" + expect_url = "https://aai.api.simpledemo.openecomp.org:8443/aai/v13" + expect_user = "AAI" + expect_pass = "AAI" + expect_headers = { + 'X-FromAppId': 'MultiCloud', + 'X-TransactionId': '9001', + 'content-type': 'application/json', + 'accept': 'application/json' + } + restcall.get_res_from_aai(res, content=content) + mock_call.assert_called_once_with( + expect_url, expect_user, expect_pass, restcall.rest_no_auth, + res, "GET", content, expect_headers) |