summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEthan Lynn <ethanlynnl@vmware.com>2018-06-13 10:01:36 +0800
committerEthan Lynn <ethanlynnl@vmware.com>2018-06-13 10:06:16 +0800
commitafd19e309b2a9361627704c51c385770f4bc3aaa (patch)
tree41a350197087a7d128434bae9882f68b365cc331
parenta73d35d8241aa899afca01470ad444779bbd32f5 (diff)
Add test_call_req_not_200 for rest_call
Add test_call_req_not_200 for rest_call Change-Id: Ied82f6016191e6cdc1bce362bbc3ad536293276a Issue-ID: MULTICLOUD-199 Signed-off-by: Ethan Lynn <ethanlynnl@vmware.com>
-rw-r--r--vio/vio/tests/test_restcall.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/vio/vio/tests/test_restcall.py b/vio/vio/tests/test_restcall.py
index 051dddf..08e38a9 100644
--- a/vio/vio/tests/test_restcall.py
+++ b/vio/vio/tests/test_restcall.py
@@ -64,3 +64,15 @@ class TestRestCall(unittest.TestCase):
ret = restcall.call_req("http://onap.org/", "user", "pass",
restcall.rest_no_auth, "vim", "GET")
self.assertEqual(expect_ret, ret)
+
+ @mock.patch("httplib2.Http.request")
+ def test_call_req_not_200(self, mock_req):
+ mock_resp = {
+ "status": "404"
+ }
+ resp_content = "hello"
+ mock_req.return_value = mock_resp, resp_content
+ expect_ret = [1, resp_content, "404", mock_resp]
+ ret = restcall.call_req("http://onap.org/", "user", "pass",
+ restcall.rest_no_auth, "vim", "GET")
+ self.assertEqual(expect_ret, ret)