summaryrefslogtreecommitdiffstats
path: root/vio
diff options
context:
space:
mode:
authorEthan Lynn <ethanlynnl@vmware.com>2018-06-13 10:20:27 +0800
committerEthan Lynn <ethanlynnl@vmware.com>2018-06-13 10:20:27 +0800
commit1a41a12dfae60165635a8b442e84042280ed79d7 (patch)
tree91daec5d1cd56d310f01576215f966cb2eb226b7 /vio
parentfe23fe497db5aab58dff966575b6c79928fbb842 (diff)
Add test_call_req_url_err
Add test_call_req_url_err Change-Id: Ic4ee391b8c065b8b35690b55faf6d5d3f90ee192 Issue-ID: MULTICLOUD-199 Signed-off-by: Ethan Lynn <ethanlynnl@vmware.com>
Diffstat (limited to 'vio')
-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)