summaryrefslogtreecommitdiff
path: root/src/leap/tests/mocks/manager.py
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-07-22 21:10:15 -0700
committerkali <kali@leap.se>2012-07-22 21:10:15 -0700
commitc46d8da153ac658c8bd145376e22b1218db1090a (patch)
tree0943a4a866d9f3b1bc590c1c23f810ca13635f9e /src/leap/tests/mocks/manager.py
initial import
Diffstat (limited to 'src/leap/tests/mocks/manager.py')
-rw-r--r--src/leap/tests/mocks/manager.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/leap/tests/mocks/manager.py b/src/leap/tests/mocks/manager.py
new file mode 100644
index 00000000..564631cd
--- /dev/null
+++ b/src/leap/tests/mocks/manager.py
@@ -0,0 +1,20 @@
+from mock import Mock
+
+from eip_client.vpnmanager import OpenVPNManager
+
+vpn_commands = {
+ 'status': [
+ 'OpenVPN STATISTICS', 'Updated,Mon Jun 25 11:51:21 2012',
+ 'TUN/TAP read bytes,306170', 'TUN/TAP write bytes,872102',
+ 'TCP/UDP read bytes,986177', 'TCP/UDP write bytes,439329',
+ 'Auth read bytes,872102'],
+ 'state': ['1340616463,CONNECTED,SUCCESS,172.28.0.2,198.252.153.38'],
+ # XXX add more tests
+ }
+
+
+def get_openvpn_manager_mocks():
+ manager = OpenVPNManager()
+ manager.status = Mock(return_value='\n'.join(vpn_commands['status']))
+ manager.state = Mock(return_value=vpn_commands['state'][0])
+ return manager