changeset 62f84787fbd1 in trytond:6.0
details: https://hg.tryton.org/trytond?cmd=changeset&node=62f84787fbd1
description:
        Update sendmail tests for SSL context

        issue11564
        (grafted from f2213e8ce5b209e35d849f46387917d252b4a435)
diffstat:

 trytond/tests/test_sendmail.py |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r 8a240f0f4f06 -r 62f84787fbd1 trytond/tests/test_sendmail.py
--- a/trytond/tests/test_sendmail.py    Tue Jun 21 10:16:35 2022 +0200
+++ b/trytond/tests/test_sendmail.py    Tue Jun 21 10:57:08 2022 +0200
@@ -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 @@
             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'

Reply via email to