From 75f4128f5ed515c4df57275bf1479ccdf741c83f Mon Sep 17 00:00:00 2001 From: kali Date: Thu, 6 Sep 2012 03:15:53 +0900 Subject: make tests pass. forgot to update eipconnection tests after #504 changes :( --- src/leap/baseapp/eip.py | 1 + src/leap/eip/openvpnconnection.py | 34 +++++++++++--------------------- src/leap/eip/tests/test_eipconnection.py | 8 +------- 3 files changed, 14 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/leap/baseapp/eip.py b/src/leap/baseapp/eip.py index afdb7adc..f26c9f88 100644 --- a/src/leap/baseapp/eip.py +++ b/src/leap/baseapp/eip.py @@ -193,6 +193,7 @@ class EIPConductorAppMixin(object): """ if self.conductor.has_errors(): logger.debug('not starting vpn; conductor has errors') + #import ipdb;ipdb.set_trace() if self.eip_service_started is False: try: diff --git a/src/leap/eip/openvpnconnection.py b/src/leap/eip/openvpnconnection.py index 4a6a495a..ec8b48bf 100644 --- a/src/leap/eip/openvpnconnection.py +++ b/src/leap/eip/openvpnconnection.py @@ -57,16 +57,16 @@ to be triggered for each one of them. self.proto = None ################################## - # XXX move all error messages - # into a more encapsulated object. - self.missing_pkexec = False - self.missing_auth_agent = False - - self.bad_keyfile_perms = False - self.missing_vpn_keyfile = False - self.missing_provider = False - self.missing_definition = False - self.bad_provider = False + # This is handled by Exception attrs + # now (see #504) + #self.missing_pkexec = False + #self.missing_auth_agent = False + + #self.bad_keyfile_perms = False + #self.missing_vpn_keyfile = False + #self.missing_provider = False + #self.missing_definition = False + #self.bad_provider = False ################################# #XXX workaround for signaling @@ -107,27 +107,17 @@ to be triggered for each one of them. except eip_exceptions.EIPNoPolkitAuthAgentAvailable: command = args = None # XXX deprecate - self.missing_auth_agent = True + #self.missing_auth_agent = True raise except eip_exceptions.EIPNoPkexecAvailable: command = args = None - self.missing_pkexec = True + #self.missing_pkexec = True raise # XXX if not command, signal error. self.command = command self.args = args - def _get_or_create_config(self): - """ - retrieves the config options from defaults or - home file, or config file passed in command line. - populates command and args to be passed to subprocess. - """ - # XXX does nothing. - # XXX should get config? or get from checker? - pass - def _check_vpn_keys(self): """ checks for correct permissions on vpn keys diff --git a/src/leap/eip/tests/test_eipconnection.py b/src/leap/eip/tests/test_eipconnection.py index 23f645c3..ce9d39e2 100644 --- a/src/leap/eip/tests/test_eipconnection.py +++ b/src/leap/eip/tests/test_eipconnection.py @@ -27,9 +27,6 @@ class NotImplementedError(Exception): @patch('OpenVPNConnection._get_or_create_config') @patch('OpenVPNConnection._set_ovpn_command') class MockedEIPConnection(EIPConnection): - def _get_or_create_config(self): - self._set_ovpn_command() - def _set_ovpn_command(self): self.command = "mock_command" self.args = [1, 2, 3] @@ -64,6 +61,7 @@ class EIPConductorTest(BaseLeapTest): # some methods mocked self.manager = Mock(name="openvpnmanager_mock") self.con = MockedEIPConnection() + self.con.run_openvpn_checks() def tearDown(self): del self.con @@ -78,10 +76,6 @@ class EIPConductorTest(BaseLeapTest): """ con = self.con self.assertEqual(con.autostart, True) - self.assertEqual(con.missing_pkexec, False) - self.assertEqual(con.missing_vpn_keyfile, False) - self.assertEqual(con.missing_provider, False) - self.assertEqual(con.bad_provider, False) def test_ovpn_command(self): """ -- cgit v1.2.3