How to use the aiosmtplib.SMTPException function in aiosmtplib

To help you get started, we’ve selected a few aiosmtplib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cole / aiosmtplib / tests / test_errors.py View on Github external
def test_raise_smtp_exception(message):
    with pytest.raises(SMTPException) as excinfo:
        raise SMTPException(message)

    assert excinfo.value.message == message
github cole / aiosmtplib / tests / test_errors.py View on Github external
def test_raise_smtp_exception(message):
    with pytest.raises(SMTPException) as excinfo:
        raise SMTPException(message)

    assert excinfo.value.message == message
github cole / aiosmtplib / tests / test_tls.py View on Github external
async def test_starttls_not_supported(
    smtp_client, smtpd_server, smtpd_class, smtpd_response_handler_factory, monkeypatch
):
    response_handler = smtpd_response_handler_factory(
        "{} HELP".format(SMTPStatus.completed)
    )
    monkeypatch.setattr(smtpd_class, "smtp_EHLO", response_handler)

    async with smtp_client:
        await smtp_client.ehlo()

        with pytest.raises(SMTPException):
            await smtp_client.starttls(validate_certs=False)
github cole / aiosmtplib / tests / test_tls.py View on Github external
async def test_starttls_advertised_but_not_supported(
    smtp_client, smtpd_server, smtpd_class, smtpd_response_handler_factory, monkeypatch
):
    response_handler = smtpd_response_handler_factory(
        "{} please login".format(SMTPStatus.tls_not_available)
    )
    monkeypatch.setattr(smtpd_class, "smtp_STARTTLS", response_handler)

    async with smtp_client:
        await smtp_client.ehlo()

        with pytest.raises(SMTPException):
            await smtp_client.starttls(validate_certs=False)
github cole / aiosmtplib / tests / test_errors.py View on Github external
def test_raise_smtp_not_supported(message):
    with pytest.raises(SMTPNotSupported) as excinfo:
        raise SMTPNotSupported(message)

    assert issubclass(excinfo.type, SMTPException)
    assert excinfo.value.message == message