| 1 |
""" |
| 2 |
Sync method tests. |
| 3 |
""" |
| 4 |
|
| 5 |
import email.message |
| 6 |
|
| 7 |
from aiosmtplib import SMTP |
| 8 |
|
| 9 |
|
| 10 |
def test_sendmail_sync( |
| 11 |
smtp_client_threaded: SMTP, |
| 12 |
sender_str: str, |
| 13 |
recipient_str: str, |
| 14 |
message_str: str, |
| 15 |
) -> None: |
| 16 |
errors, response = smtp_client_threaded.sendmail_sync( |
| 17 |
sender_str, [recipient_str], message_str |
| 18 |
) |
| 19 |
|
| 20 |
assert not errors |
| 21 |
assert isinstance(errors, dict) |
| 22 |
assert response != "" |
| 23 |
|
| 24 |
|
| 25 |
def test_send_message_sync( |
| 26 |
smtp_client_threaded: SMTP, |
| 27 |
message: email.message.EmailMessage, |
| 28 |
) -> None: |
| 29 |
errors, response = smtp_client_threaded.send_message_sync(message) |
| 30 |
|
| 31 |
assert not errors |
| 32 |
assert isinstance(errors, dict) |
| 33 |
assert response != "" |