summaryrefslogtreecommitdiffstats
path: root/multivimbroker
diff options
context:
space:
mode:
authorEthan Lynn <ethanlynnl@vmware.com>2018-03-23 10:58:19 +0800
committerEthan Lynn <ethanlynnl@vmware.com>2018-03-23 10:58:58 +0800
commit0ed08905a821ab0c1d1a2ed5cc1d4fe605d94e64 (patch)
treeceb006c4e8e5b5879da971e0b794004a749d07b1 /multivimbroker
parent7850f681fb63a7dca983accd42433926334fd287 (diff)
Add test_get_res_from_aai
Add test test_get_res_from_aai for restcall.py Change-Id: I7fd4a7d59ce5da891f3cb9d214aa1ffd306abcac Issue-ID: MULTICLOUD-198 Signed-off-by: Ethan Lynn <ethanlynnl@vmware.com>
Diffstat (limited to 'multivimbroker')
-rw-r--r--multivimbroker/multivimbroker/tests/test_restcall.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/multivimbroker/multivimbroker/tests/test_restcall.py b/multivimbroker/multivimbroker/tests/test_restcall.py
index b76b0a6..4ecf04e 100644
--- a/multivimbroker/multivimbroker/tests/test_restcall.py
+++ b/multivimbroker/multivimbroker/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 multivimbroker.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)