summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2017-11-02 16:10:03 +0100
committerKali Kaneko <kali@leap.se>2017-11-02 16:10:03 +0100
commitca27ad5928aa4a814e4b61cde1efe6273d7c1b31 (patch)
tree9c9fb2f31eb5dca055eebc96d115b70e98190d75 /tests
parent46bb775119bf3cd92ce05aa1c74c65de2e84a458 (diff)
[tests] fix tests
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/vpn/test_management.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/unit/vpn/test_management.py b/tests/unit/vpn/test_management.py
index ff7e7c0d..e44f5331 100644
--- a/tests/unit/vpn/test_management.py
+++ b/tests/unit/vpn/test_management.py
@@ -45,9 +45,12 @@ class StateListener(object):
def __init__(self):
self.states = []
- def change_state(self, state):
+ def changeState(self, state):
self.states.append(state)
+ def getStateHistory(self):
+ return self.states
+
class ManagementTestCase(unittest.TestCase):
@@ -66,10 +69,12 @@ class ManagementTestCase(unittest.TestCase):
def test_get_state_history(self):
proto = ManagementProtocol()
+ listener = StateListener()
+ proto.addStateListener(listener)
feed_the_protocol(proto, session1)
- log = proto.getStateHistory()
- states = [st.state for st in log.values()]
- assert len(log) == 4
+ log = listener.getStateHistory()
+ states = [st.state for st in log]
+ assert len(states) == 4
assert states == ['AUTH', 'GET_CONFIG', 'ASSIGN_IP', 'CONNECTED']
def test_state_listener(self):
@@ -128,8 +133,5 @@ class ManagementTestCase(unittest.TestCase):
info = proto.getInfo()
assert info['remote'] == '46.165.242.169'
assert info['rport'] == '443'
- assert info['state'] == 'CONNECTED'
- assert info['state_simple'] == 'ON'
- assert info['state_legend'] == 'Initialization Sequence Completed'
assert info['openvpn_version'].startswith('OpenVPN 2.4.0')
assert info['pid'] == 23783