diff options
author | kali <kali@leap.se> | 2012-08-27 06:37:10 +0900 |
---|---|---|
committer | kali <kali@leap.se> | 2012-08-27 06:37:10 +0900 |
commit | 10292cac27bc2f10e2b5768c84091a73105bc495 (patch) | |
tree | fa232d1c1fb560c1364ec035a16a49d9deb8decd /src/leap/eip | |
parent | 2bbe0e0a2d852a1a7261b2fa927eab6e8f41c8c3 (diff) |
make eipconductor test use BaseLeapTest
Diffstat (limited to 'src/leap/eip')
-rw-r--r-- | src/leap/eip/tests/test_eipconnection.py | 50 |
1 files changed, 21 insertions, 29 deletions
diff --git a/src/leap/eip/tests/test_eipconnection.py b/src/leap/eip/tests/test_eipconnection.py index dee28935..7d8acad6 100644 --- a/src/leap/eip/tests/test_eipconnection.py +++ b/src/leap/eip/tests/test_eipconnection.py @@ -16,6 +16,7 @@ from mock import Mock, patch # MagicMock from leap.base import constants from leap.eip.eipconnection import EIPConnection from leap.eip.exceptions import ConnectionRefusedError +from leap.testing.basetest import BaseLeapTest _system = platform.system() @@ -36,11 +37,30 @@ class MockedEIPConnection(EIPConnection): self.args = [1, 2, 3] -class EIPConductorTest(unittest.TestCase): +class EIPConductorTest(BaseLeapTest): __name__ = "eip_conductor_tests" def setUp(self): + # XXX there's a conceptual/design + # mistake here. + # If we're testing just attrs after init, + # init shold not be doing so much side effects. + + # for instance: + # We have to TOUCH a keys file because + # we're triggerig the key checks FROM + # the constructo. me not like that, + # key checker should better be called explicitelly. + filepath = os.path.expanduser( + '~/.config/leap/providers/%s/openvpn.keys' + % constants.DEFAULT_TEST_PROVIDER) + self.touch(filepath) + self.chmod600(filepath) + + # we init the manager with only + # some methods mocked + self.manager = Mock( name="openvpnmanager_mock") @@ -51,21 +71,6 @@ class EIPConductorTest(unittest.TestCase): del self.con # - # helpers - # - - def _missing_test_for_plat(self, do_raise=False): - if do_raise: - raise NotImplementedError( - "This test is not implemented " - "for the running platform: %s" % - _system) - - def touch(self, filepath): - with open(filepath, 'w') as fp: - fp.write('') - - # # tests # @@ -81,19 +86,6 @@ class EIPConductorTest(unittest.TestCase): """ default attrs as expected """ - # XXX there's a conceptual/design - # mistake here. - # If we're testing just attrs after init, - # init shold not be doing so much side effects. - - # for instance: - # We have to TOUCH a keys file because - # we're triggerig the key checks FROM - # the constructo. me not like that, - # key checker should better be called explicitelly. - self.touch(os.path.expanduser( - '~/.config/leap/providers/%s/openvpn.keys' - % constants.DEFAULT_TEST_PROVIDER)) con = self.con self.assertEqual(con.autostart, True) self.assertEqual(con.missing_pkexec, False) |