File: test_sync.py

package info (click to toggle)
aiosmtplib 4.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 572 kB
  • sloc: python: 5,516; makefile: 20; sh: 6
file content (33 lines) | stat: -rw-r--r-- 683 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""
Sync method tests.
"""

import email.message

from aiosmtplib import SMTP


def test_sendmail_sync(
    smtp_client_threaded: SMTP,
    sender_str: str,
    recipient_str: str,
    message_str: str,
) -> None:
    errors, response = smtp_client_threaded.sendmail_sync(
        sender_str, [recipient_str], message_str
    )

    assert not errors
    assert isinstance(errors, dict)
    assert response != ""


def test_send_message_sync(
    smtp_client_threaded: SMTP,
    message: email.message.EmailMessage,
) -> None:
    errors, response = smtp_client_threaded.send_message_sync(message)

    assert not errors
    assert isinstance(errors, dict)
    assert response != ""