summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vio/vio/tests/test_restcall.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/vio/vio/tests/test_restcall.py b/vio/vio/tests/test_restcall.py
index 08e38a9..3cb22ca 100644
--- a/vio/vio/tests/test_restcall.py
+++ b/vio/vio/tests/test_restcall.py
@@ -76,3 +76,16 @@ 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("traceback.format_exc")
+ @mock.patch("sys.exc_info")
+ @mock.patch("httplib2.Http.request")
+ def test_call_req_response_not_ready(self, mock_req, mock_sys,
+ mock_traceback):
+ mock_sys.return_value = "httplib.ResponseNotReady"
+ mock_req.side_effect = [Exception("httplib.ResponseNotReady")] * 3
+ expect_ret = [1, "Unable to connect to http://onap.org/vim", "", ""]
+ ret = restcall.call_req("http://onap.org/", "user", "pass",
+ restcall.rest_no_auth, "vim", "GET")
+ self.assertEqual(expect_ret, ret)
+ self.assertEqual(3, mock_req.call_count)