summaryrefslogtreecommitdiff
path: root/src/leap/eip
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-10-06 01:47:32 +0900
committerkali <kali@leap.se>2012-10-06 01:47:32 +0900
commit31e04a68c38231ee1da693e72f4f3456672e30d0 (patch)
treeca7b5e06a53dbe666ee11b60a640393838271f42 /src/leap/eip
parentcdc80a4b84bc68dd179376e8c4cbd7db478ffd32 (diff)
parent1c77b95d8f0a69af582d6cddfea2e378ee2da80f (diff)
Merge branch 'feature/detect_vpn' of ssh://leap.se/leap_client into feature/detect_vpn
Diffstat (limited to 'src/leap/eip')
-rw-r--r--src/leap/eip/tests/test_openvpnconnection.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/leap/eip/tests/test_openvpnconnection.py b/src/leap/eip/tests/test_openvpnconnection.py
index 885c80b3..61769f04 100644
--- a/src/leap/eip/tests/test_openvpnconnection.py
+++ b/src/leap/eip/tests/test_openvpnconnection.py
@@ -1,6 +1,7 @@
import logging
import os
import platform
+import psutil
import shutil
#import socket
@@ -16,6 +17,7 @@ from mock import Mock, patch # MagicMock
from leap.eip import config as eipconfig
from leap.eip import openvpnconnection
+from leap.eip import exceptions as eipexceptions
from leap.eip.udstelnet import UDSTelnet
from leap.testing.basetest import BaseLeapTest
@@ -73,6 +75,16 @@ class OpenVPNConnectionTest(BaseLeapTest):
# tests
#
+ def test_detect_vpn(self):
+ openvpn_connection = openvpnconnection.OpenVPNConnection()
+ with patch.object(psutil, "get_process_list") as mocked_psutil:
+ with self.assertRaises(eipexceptions.OpenVPNAlreadyRunning):
+ mocked_process = Mock()
+ mocked_process.name = "openvpn"
+ mocked_psutil.return_value = [mocked_process]
+ openvpn_connection._check_if_running_instance()
+ openvpn_connection._check_if_running_instance()
+
@unittest.skipIf(_system == "Windows", "lin/mac only")
def test_lin_mac_default_init(self):
"""