summaryrefslogtreecommitdiff
path: root/src/leap/base/tests/test_checks.py
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2012-12-24 10:14:58 -0200
committerdrebs <drebs@leap.se>2012-12-24 10:14:58 -0200
commit319e279b59ac080779d0a3375ae4d6582f5ee6a3 (patch)
tree118dd0f495c0d54f2b2c66ea235e4e4e6b8cefd5 /src/leap/base/tests/test_checks.py
parentca5fb41a55e1292005ed186baf3710831d9ad678 (diff)
parenta7b091a0553e6120f3e0eb6d4e73a89732c589b2 (diff)
Merge branch 'develop' of ssh://code.leap.se/leap_client into develop
Diffstat (limited to 'src/leap/base/tests/test_checks.py')
-rw-r--r--src/leap/base/tests/test_checks.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/leap/base/tests/test_checks.py b/src/leap/base/tests/test_checks.py
index 8d573b1e..7a694f89 100644
--- a/src/leap/base/tests/test_checks.py
+++ b/src/leap/base/tests/test_checks.py
@@ -118,6 +118,22 @@ class LeapNetworkCheckTest(BaseLeapTest):
with self.assertRaises(exceptions.NoInternetConnection):
checker.check_internet_connection()
+ with patch.object(requests, "get") as mocked_get:
+ mocked_get.side_effect = requests.ConnectionError(
+ "[Errno 113] No route to host")
+ with self.assertRaises(exceptions.NoInternetConnection):
+ with patch.object(checker, "ping_gateway") as mock_ping:
+ mock_ping.return_value = True
+ checker.check_internet_connection()
+
+ with patch.object(requests, "get") as mocked_get:
+ mocked_get.side_effect = requests.ConnectionError(
+ "[Errno 113] No route to host")
+ with self.assertRaises(exceptions.NoInternetConnection):
+ with patch.object(checker, "ping_gateway") as mock_ping:
+ mock_ping.side_effect = exceptions.NoConnectionToGateway
+ checker.check_internet_connection()
+
@unittest.skipUnless(_uid == 0, "root only")
def test_ping_gateway(self):
checker = checks.LeapNetworkChecker()