Skip to content

Commit

Permalink
test: avoids from using deprecated attrs when testing ssl_connection
Browse files Browse the repository at this point in the history
  • Loading branch information
tkzt committed Nov 28, 2023
1 parent de39ad2 commit 35d5285
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from pathlib import Path
from unittest.mock import Mock, patch
from ssl import SSLError
from ssl import SSLContext, SSLError, PROTOCOL_TLS_CLIENT
from smtplib import SMTP, SMTPException
from email import message_from_binary_file, message_from_bytes
from io import StringIO
Expand Down Expand Up @@ -343,8 +343,12 @@ def test_email_tls_attempts_starttls(self):
pass

def test_email_ssl_attempts_ssl_connection(self):
with SmtpdContext(self.app.extensions['mailman']):
mailman = self.app.extensions['mailman']
with SmtpdContext(mailman):
self.app.extensions['mailman'].use_ssl = True
self.app.extensions['mailman'].context = SSLContext(
PROTOCOL_TLS_CLIENT,
)
backend = smtp.EmailBackend()
self.assertTrue(backend.use_ssl)
with self.assertRaises(SSLError):
Expand Down

0 comments on commit 35d5285

Please sign in to comment.