diff options
Diffstat (limited to 'src/leap/eip/tests')
-rw-r--r-- | src/leap/eip/tests/test_checks.py | 14 | ||||
-rw-r--r-- | src/leap/eip/tests/test_eipconnection.py | 30 |
2 files changed, 23 insertions, 21 deletions
diff --git a/src/leap/eip/tests/test_checks.py b/src/leap/eip/tests/test_checks.py index 83561833..1c79ce0c 100644 --- a/src/leap/eip/tests/test_checks.py +++ b/src/leap/eip/tests/test_checks.py @@ -32,7 +32,7 @@ class EIPCheckTest(BaseLeapTest): # test methods are there, and can be called from run_all def test_checker_should_implement_check_methods(self): - checker = eipchecks.EIPChecker() + checker = eipchecks.EIPConfigChecker() self.assertTrue(hasattr(checker, "check_default_eipconfig"), "missing meth") @@ -45,7 +45,7 @@ class EIPCheckTest(BaseLeapTest): self.assertTrue(hasattr(checker, "ping_gateway"), "missing meth") def test_checker_should_actually_call_all_tests(self): - checker = eipchecks.EIPChecker() + checker = eipchecks.EIPConfigChecker() mc = Mock() checker.run_all(checker=mc) @@ -64,7 +64,7 @@ class EIPCheckTest(BaseLeapTest): # test individual check methods def test_check_default_eipconfig(self): - checker = eipchecks.EIPChecker() + checker = eipchecks.EIPConfigChecker() # no eip config (empty home) eipconfig = baseconfig.get_config_file(eipconstants.EIP_CONFIG) self.assertFalse(os.path.isfile(eipconfig)) @@ -79,7 +79,7 @@ class EIPCheckTest(BaseLeapTest): # run validation methods. def test_check_is_there_default_provider(self): - checker = eipchecks.EIPChecker() + checker = eipchecks.EIPConfigChecker() # we do dump a sample eip config, but lacking a # default provider entry. # This error will be possible catched in a different @@ -104,7 +104,7 @@ class EIPCheckTest(BaseLeapTest): with patch.object(requests, "get") as mocked_get: mocked_get.return_value.status_code = 200 mocked_get.return_value.json = DEFAULT_PROVIDER_DEFINITION - checker = eipchecks.EIPChecker(fetcher=requests) + checker = eipchecks.EIPConfigChecker(fetcher=requests) sampleconfig = eipconstants.EIP_SAMPLE_JSON checker.fetch_definition(config=sampleconfig) @@ -122,12 +122,12 @@ class EIPCheckTest(BaseLeapTest): with patch.object(requests, "get") as mocked_get: mocked_get.return_value.status_code = 200 mocked_get.return_value.json = eipconstants.EIP_SAMPLE_SERVICE - checker = eipchecks.EIPChecker(fetcher=requests) + checker = eipchecks.EIPConfigChecker(fetcher=requests) sampleconfig = eipconstants.EIP_SAMPLE_JSON checker.fetch_definition(config=sampleconfig) def test_check_complete_eip_config(self): - checker = eipchecks.EIPChecker() + checker = eipchecks.EIPConfigChecker() with self.assertRaises(eipexceptions.EIPConfigurationError): sampleconfig = copy.copy(eipconstants.EIP_SAMPLE_JSON) sampleconfig['provider'] = None diff --git a/src/leap/eip/tests/test_eipconnection.py b/src/leap/eip/tests/test_eipconnection.py index 7d8acad6..26f6529e 100644 --- a/src/leap/eip/tests/test_eipconnection.py +++ b/src/leap/eip/tests/test_eipconnection.py @@ -50,8 +50,12 @@ class EIPConductorTest(BaseLeapTest): # for instance: # We have to TOUCH a keys file because # we're triggerig the key checks FROM - # the constructo. me not like that, + # the constructor. me not like that, # key checker should better be called explicitelly. + + # XXX change to keys_checker invocation + # (see config_checker) + filepath = os.path.expanduser( '~/.config/leap/providers/%s/openvpn.keys' % constants.DEFAULT_TEST_PROVIDER) @@ -60,12 +64,8 @@ class EIPConductorTest(BaseLeapTest): # we init the manager with only # some methods mocked - - self.manager = Mock( - name="openvpnmanager_mock") - + self.manager = Mock(name="openvpnmanager_mock") self.con = MockedEIPConnection() - #manager=self.manager) def tearDown(self): del self.con @@ -74,14 +74,6 @@ class EIPConductorTest(BaseLeapTest): # tests # - @unittest.skip - #ain't manager anymore! - def test_manager_was_initialized(self): - """ - manager init ok during conductor init? - """ - self.manager.assert_called_once_with() - def test_vpnconnection_defaults(self): """ default attrs as expected @@ -109,6 +101,16 @@ class EIPConductorTest(BaseLeapTest): self.assertEqual(self.con.args, [1, 2, 3]) + # config checks + + def test_config_checked_called(self): + del(self.con) + config_checker = Mock() + self.con = MockedEIPConnection(config_checker=config_checker) + self.assertTrue(config_checker.called) + self.con.run_checks() + self.con.config_checker.run_all.assert_called_with(skip_download=False) + # connect/disconnect calls def test_disconnect(self): |