summaryrefslogtreecommitdiff
path: root/src/leap/eip/tests/test_eipconnection.py
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-11-14 00:33:05 +0900
committerkali <kali@leap.se>2012-11-14 00:33:05 +0900
commitd24c7328fa845737dbb83d512e4b3f287634c4cc (patch)
treeae0409bd742ce3a6f994ae9bb31fc5ab7225f1c6 /src/leap/eip/tests/test_eipconnection.py
parentd2dcf5a1060d60c451570349a6a06ad102d6924c (diff)
make tests pass + pep8
They were breaking mainly because I did not bother to have a pass over them to change the PROVIDER settings from the branding case. All good now, although much testing is yet needed and some refactor could be used. long live green tests!
Diffstat (limited to 'src/leap/eip/tests/test_eipconnection.py')
-rw-r--r--src/leap/eip/tests/test_eipconnection.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/leap/eip/tests/test_eipconnection.py b/src/leap/eip/tests/test_eipconnection.py
index bb643ae0..aefca36f 100644
--- a/src/leap/eip/tests/test_eipconnection.py
+++ b/src/leap/eip/tests/test_eipconnection.py
@@ -19,6 +19,8 @@ from leap.testing.basetest import BaseLeapTest
_system = platform.system()
+PROVIDER = "testprovider.example.org"
+
class NotImplementedError(Exception):
pass
@@ -27,6 +29,7 @@ class NotImplementedError(Exception):
@patch('OpenVPNConnection._get_or_create_config')
@patch('OpenVPNConnection._set_ovpn_command')
class MockedEIPConnection(EIPConnection):
+
def _set_ovpn_command(self):
self.command = "mock_command"
self.args = [1, 2, 3]
@@ -35,6 +38,7 @@ class MockedEIPConnection(EIPConnection):
class EIPConductorTest(BaseLeapTest):
__name__ = "eip_conductor_tests"
+ provider = PROVIDER
def setUp(self):
# XXX there's a conceptual/design
@@ -51,8 +55,8 @@ class EIPConductorTest(BaseLeapTest):
# XXX change to keys_checker invocation
# (see config_checker)
- keyfiles = (eipspecs.provider_ca_path(),
- eipspecs.client_cert_path())
+ keyfiles = (eipspecs.provider_ca_path(domain=self.provider),
+ eipspecs.client_cert_path(domain=self.provider))
for filepath in keyfiles:
self.touch(filepath)
self.chmod600(filepath)
@@ -61,6 +65,7 @@ class EIPConductorTest(BaseLeapTest):
# some methods mocked
self.manager = Mock(name="openvpnmanager_mock")
self.con = MockedEIPConnection()
+ self.con.provider = self.provider
self.con.run_openvpn_checks()
def tearDown(self):
@@ -118,8 +123,9 @@ class EIPConductorTest(BaseLeapTest):
self.con.status.CONNECTED)
# disconnect
+ self.con.cleanup = Mock()
self.con.disconnect()
- self.con._disconnect.assert_called_once_with()
+ self.con.cleanup.assert_called_once_with()
# new status should be disconnected
# XXX this should evolve and check no errors