summaryrefslogtreecommitdiff
path: root/src/leap/base/tests/test_checks.py
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-12-07 02:23:09 +0900
committerkali <kali@leap.se>2012-12-07 02:23:09 +0900
commitc963fcf443fec18c46aa40801436533f60ebbe57 (patch)
treefec0a56c64f1120aa064d824bc2427aa8ca91899 /src/leap/base/tests/test_checks.py
parentfa59d347e82e3ddfb758658e15bf8a2d8e3d83b1 (diff)
parent4c2f68b1158f3840f33a38a81a5fc03495d28466 (diff)
Merge branch 'feature/improve_coverage' 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()