summaryrefslogtreecommitdiff
path: root/src/leap/base/checks.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/base/checks.py')
-rw-r--r--src/leap/base/checks.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/leap/base/checks.py b/src/leap/base/checks.py
index 8abdf774..0ebf4f2f 100644
--- a/src/leap/base/checks.py
+++ b/src/leap/base/checks.py
@@ -75,9 +75,10 @@ class LeapNetworkChecker(object):
return True
def _get_route_table_linux(self):
-
- with open("/proc/net/route") as f:
- route_table = f.readlines()
+ # do not use context manager, tests pass a StringIO
+ f = open("/proc/net/route")
+ route_table = f.readlines()
+ f.close()
#toss out header
route_table.pop(0)
if not route_table:
@@ -87,7 +88,7 @@ class LeapNetworkChecker(object):
def _get_def_iface_osx(self):
default_iface = None
#gateway = None
- routes = list(sh.route('-n', 'get', ICMP_TARGET, _iter=True))
+ routes = list(sh.route('-n', 'get', ICMP_TARGET, _iter=True))
iface = filter(lambda l: "interface" in l, routes)
if not iface:
return None, None
@@ -155,7 +156,7 @@ class LeapNetworkChecker(object):
imo...)
"""
if _platform == "Linux":
- default_iface, gw = self.get_def_iface_linux()
+ default_iface, gw = self._get_def_iface_linux()
elif _platform == "Darwin":
default_iface, gw = self.get_def_iface_osx()
else: