summaryrefslogtreecommitdiff
path: root/service/test/unit/bitmask_libraries
diff options
context:
space:
mode:
authorBruno Wagner <bwagner@riseup.net>2015-11-03 19:41:34 -0200
committerPixelated <pixelated@pix-poa-1>2015-11-03 19:47:35 -0200
commit20962bdea85b9e0ac04ab9f714853ca8516cd7f4 (patch)
tree595bea74597a2147b57afe4fde59a7ab1318018f /service/test/unit/bitmask_libraries
parent0f84c6354a116fd53628b23a56c1528c5dd3e8ef (diff)
Issue #499 Moved remote smtp configuration
We removed the common parts from the bitmask libraries smtp and adapted the tests. We also advanced the new mail sender implementation, but it is coupled to the twisted.mail.smtp.User currently and we need to adapt leap mail to remove this dependency
Diffstat (limited to 'service/test/unit/bitmask_libraries')
-rw-r--r--service/test/unit/bitmask_libraries/test_smtp.py15
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()