summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vio/vio/tests/test_restcall.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/vio/vio/tests/test_restcall.py b/vio/vio/tests/test_restcall.py
index 3cb22ca..b04aec1 100644
--- a/vio/vio/tests/test_restcall.py
+++ b/vio/vio/tests/test_restcall.py
@@ -10,6 +10,7 @@
import mock
import unittest
+import urllib2
from vio.pub.utils import restcall
@@ -89,3 +90,12 @@ class TestRestCall(unittest.TestCase):
restcall.rest_no_auth, "vim", "GET")
self.assertEqual(expect_ret, ret)
self.assertEqual(3, mock_req.call_count)
+
+ @mock.patch("httplib2.Http.request")
+ def test_call_req_url_err(self, mock_req):
+ urlerr = urllib2.URLError("urlerror")
+ mock_req.side_effect = [urlerr]
+ expect_ret = [2, str(urlerr), "", ""]
+ ret = restcall.call_req("http://onap.org/", "user", "pass",
+ restcall.rest_no_auth, "vim", "GET")
+ self.assertEqual(expect_ret, ret)