summaryrefslogtreecommitdiff
path: root/src/leap/eip/tests/test_openvpnconnection.py
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-12-06 00:55:07 +0900
committerkali <kali@leap.se>2012-12-12 04:27:51 +0900
commit52aa909c23bff688e2a164dca546e4a493e72fe4 (patch)
tree111e7e4a077524fda1889b24c1ad61366ef9783b /src/leap/eip/tests/test_openvpnconnection.py
parent490cde9c33039c2c5b16d929d6f8bb8e8f06f430 (diff)
cleanup lingering temporal files
Diffstat (limited to 'src/leap/eip/tests/test_openvpnconnection.py')
-rw-r--r--src/leap/eip/tests/test_openvpnconnection.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/leap/eip/tests/test_openvpnconnection.py b/src/leap/eip/tests/test_openvpnconnection.py
index 0f27facf..f7493567 100644
--- a/src/leap/eip/tests/test_openvpnconnection.py
+++ b/src/leap/eip/tests/test_openvpnconnection.py
@@ -58,16 +58,27 @@ class OpenVPNConnectionTest(BaseLeapTest):
def setUp(self):
# XXX this will have to change for win, host=localhost
host = eipconfig.get_socket_path()
+ self.host = host
self.manager = MockedOpenVPNConnection(host=host)
def tearDown(self):
+ pass
+
+ def doCleanups(self):
+ super(BaseLeapTest, self).doCleanups()
+ self.cleanupSocketDir()
+
+ def cleanupSocketDir(self):
# remove the socket folder.
# XXX only if posix. in win, host is localhost, so nothing
# has to be done.
- if self.manager.host:
- folder, fpath = os.path.split(self.manager.host)
- assert folder.startswith('/tmp/leap-tmp') # safety check
- shutil.rmtree(folder)
+ if self.host:
+ folder, fpath = os.path.split(self.host)
+ try:
+ assert folder.startswith('/tmp/leap-tmp') # safety check
+ shutil.rmtree(folder)
+ except:
+ self.fail("could not remove temp file")
del self.manager
@@ -108,12 +119,14 @@ class OpenVPNConnectionTest(BaseLeapTest):
self.assertEqual(self.manager.port, 7777)
def test_port_types_init(self):
+ oldmanager = self.manager
self.manager = MockedOpenVPNConnection(port="42")
self.assertEqual(self.manager.port, 42)
self.manager = MockedOpenVPNConnection()
self.assertEqual(self.manager.port, "unix")
self.manager = MockedOpenVPNConnection(port="bad")
self.assertEqual(self.manager.port, None)
+ self.manager = oldmanager
def test_uds_telnet_called_on_connect(self):
self.manager.connect_to_management()