diff options
author | Ivan Alejandro <ivanalejandro0@gmail.com> | 2013-08-20 16:24:49 -0300 |
---|---|---|
committer | Ivan Alejandro <ivanalejandro0@gmail.com> | 2013-08-20 16:42:53 -0300 |
commit | 2a87d0d57d5fe663f814eb3dae90168c594babb5 (patch) | |
tree | 27feebf1e93219e40d5c78657c649228be565065 /src/leap/bitmask/services/eip/tests | |
parent | 1662a500c8367478cac54e71feae9c239cec4bd3 (diff) |
Improve test coverage for ProviderBootstrapper.
Diffstat (limited to 'src/leap/bitmask/services/eip/tests')
-rw-r--r-- | src/leap/bitmask/services/eip/tests/test_providerbootstrapper.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/leap/bitmask/services/eip/tests/test_providerbootstrapper.py b/src/leap/bitmask/services/eip/tests/test_providerbootstrapper.py index 6c5c6e57..b0685676 100644 --- a/src/leap/bitmask/services/eip/tests/test_providerbootstrapper.py +++ b/src/leap/bitmask/services/eip/tests/test_providerbootstrapper.py @@ -444,6 +444,25 @@ class ProviderBootstrapperActiveTest(unittest.TestCase): self.assertFalse(ProviderConfig.save.called) @mock.patch( + 'leap.bitmask.config.providerconfig.ProviderConfig.get_domain', + lambda x: where('testdomain.com')) + def test_download_provider_info_not_modified_and_no_cacert(self): + self._setup_provider_config_with("1", tempfile.mkdtemp()) + self._setup_providerbootstrapper(True) + provider_path = self._produce_dummy_provider_json() + + # set mtime to something really new + os.utime(provider_path, (-1, time.time())) + + with mock.patch.object( + ProviderConfig, 'get_api_uri', + return_value="https://localhost:%s" % (self.https_port,)): + self.pb._download_provider_info() + # we check that it doesn't save the provider + # config, because it's new enough + self.assertFalse(ProviderConfig.save.called) + + @mock.patch( 'leap.bitmask.config.providerconfig.ProviderConfig.get_ca_cert_path', lambda x: where('cacert.pem')) def test_download_provider_info_modified(self): |