diff options
Diffstat (limited to 'service/test/unit/bitmask_libraries')
-rw-r--r-- | service/test/unit/bitmask_libraries/test_smtp.py | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/service/test/unit/bitmask_libraries/test_smtp.py b/service/test/unit/bitmask_libraries/test_smtp.py index 9481c488..182a0786 100644 --- a/service/test/unit/bitmask_libraries/test_smtp.py +++ b/service/test/unit/bitmask_libraries/test_smtp.py @@ -53,20 +53,13 @@ class LeapSmtpTest(AbstractLeapTest): } self.config.timeout_in_s = 15 - def test_that_client_cert_gets_downloaded(self): - smtp = LeapSmtp(self.provider, self.auth, self.keymanager) - - with HTTMock(ca_cert_mock, not_found_mock): - smtp._download_client_certificates() - - path = self._client_cert_path() - self.assertTrue(os.path.isfile(path)) - def _client_cert_path(self): return os.path.join(self.leap_home, 'providers', 'some-server.test', 'keys', 'client', 'smtp.pem') @patch('pixelated.bitmask_libraries.smtp.setup_smtp_gateway') def test_that_start_calls_setup_smtp_gateway(self, gateway_mock): + self.provider.smtp_info = MagicMock(return_value=('smtp.some-sever.test', 1234)) + self.provider._client_cert_path = MagicMock(return_value=self._client_cert_path()) smtp = LeapSmtp(self.provider, self.auth, self.keymanager) port = 500 @@ -76,9 +69,10 @@ class LeapSmtpTest(AbstractLeapTest): smtp.ensure_running() cert_path = self._client_cert_path() - gateway_mock.assert_called_with(keymanager=self.keymanager, smtp_cert=cert_path, smtp_key=cert_path, userid='test_user@some-server.test', smtp_port='1234', encrypted_only=False, smtp_host='smtp.some-sever.test', port=port) + gateway_mock.assert_called_with(smtp_cert=cert_path, userid='test_user@some-server.test', smtp_port=1234, smtp_key=cert_path, keymanager=self.keymanager, encrypted_only=False, smtp_host='smtp.some-sever.test', port=port) def test_that_client_stop_does_nothing_if_not_started(self): + self.provider.smtp_info = MagicMock(return_value=('smtp.some-sever.test', 1234)) smtp = LeapSmtp(self.provider, self.auth, self.keymanager) with HTTMock(not_found_mock): @@ -86,6 +80,7 @@ class LeapSmtpTest(AbstractLeapTest): @patch('pixelated.bitmask_libraries.smtp.setup_smtp_gateway') def test_that_running_smtp_sevice_is_stopped(self, gateway_mock): + self.provider.smtp_info = MagicMock(return_value=('smtp.some-sever.test', 1234)) smtp = LeapSmtp(self.provider, self.auth, self.keymanager) smtp_service = MagicMock() |