Update sendmail tests for SSL context
issue11564 (grafted from f2213e8ce5b209e35d849f46387917d252b4a435) --HG-- branch : 6.0
This commit is contained in:
1 parent
aa45e4206d
commit
0deea1cace
1 file changed
+3
-3
@@ -3,7 +3,7 @@
|
||||
import smtplib
|
||||
import unittest
|
||||
from email.message import Message
|
||||
from unittest.mock import Mock, MagicMock, patch, call
|
||||
from unittest.mock import ANY, Mock, MagicMock, patch, call
|
||||
|
||||
from trytond.sendmail import (
|
||||
sendmail_transactional, sendmail, SMTPDataManager, get_smtp_server)
|
||||
@@ -58,14 +58,14 @@ class SendmailTestCase(unittest.TestCase):
|
||||
SMTP.return_value = server = Mock()
|
||||
self.assertEqual(
|
||||
get_smtp_server('smtps://localhost:25'), server)
|
||||
SMTP.assert_called_once_with('localhost', 25)
|
||||
SMTP.assert_called_once_with('localhost', 25, context=ANY)
|
||||
|
||||
with patch.object(smtplib, 'SMTP') as SMTP:
|
||||
SMTP.return_value = server = Mock()
|
||||
self.assertEqual(
|
||||
get_smtp_server('smtp+tls://localhost:25'), server)
|
||||
SMTP.assert_called_once_with('localhost', 25)
|
||||
server.starttls.assert_called_once_with()
|
||||
server.starttls.assert_called_once_with(context=ANY)
|
||||
|
||||
def test_get_smtp_server_extra_parameters(self):
|
||||
'Test get_smtp_server uri extra parameters'
|
||||
|
||||
Reference in new issue
Block a user