diff options
author | NavaL <ayoyo@thoughtworks.com> | 2016-02-12 14:50:27 +0100 |
---|---|---|
committer | NavaL <ayoyo@thoughtworks.com> | 2016-02-12 14:50:27 +0100 |
commit | f0145903a188a6eead1d07b188603488fd5af1e6 (patch) | |
tree | b4b2dd6ae3e898ed0fff405f41c4c5732440e430 /service/test/unit/bitmask_libraries | |
parent | c80af2dcd169dd1ae7a5624c319664d20e431841 (diff) |
mocking all paths to exists
Issue #604
Diffstat (limited to 'service/test/unit/bitmask_libraries')
-rw-r--r-- | service/test/unit/bitmask_libraries/test_smtp_client_certificate.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/service/test/unit/bitmask_libraries/test_smtp_client_certificate.py b/service/test/unit/bitmask_libraries/test_smtp_client_certificate.py index 155f46e9..58a7525f 100644 --- a/service/test/unit/bitmask_libraries/test_smtp_client_certificate.py +++ b/service/test/unit/bitmask_libraries/test_smtp_client_certificate.py @@ -46,8 +46,8 @@ class TestSmtpClientCertificate(unittest.TestCase): self.assertEqual(self.pem_path, result) verify(self.downloader).download_to(self.pem_path) - def test_download_certificate_if_redownload_necessary(self): - when(os.path).exists(self.pem_path).thenReturn(True) + def test_download_certificate_if_redownload_necessary_e_g_certificate_expired(self): + self.pretend_all_paths_exist() when(certs).should_redownload(self.pem_path).thenReturn(True) cert = SmtpClientCertificate(self.provider, self.auth, self.tmp_dir.name) @@ -56,6 +56,9 @@ class TestSmtpClientCertificate(unittest.TestCase): self.assertEqual(self.pem_path, result) verify(self.downloader).download_to(self.pem_path) + def pretend_all_paths_exist(self): + when(os.path).exists(ANY()).thenReturn(True) + def test_skip_download_if_already_downloaded_and_still_valid(self): when(os.path).exists(self.pem_path).thenReturn(True) when(certs).should_redownload(ANY()).thenReturn(False) |