diff options
-rw-r--r-- | vio/vio/tests/test_restcall.py | 12 |
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) |