Пример #1
0
def test_simple_email(httpserver, smtpserver):
    email_pub = SimpleEmailPublisher({"real_name": "test", "address": "*****@*****.**"},
                                     [{"real_name": "test", "address": "*****@*****.**"}],
                                     host=smtpserver.addr[0], port=smtpserver.addr[1])
    http_validator = \
        HttpValidation.get(httpserver.url).expect_status_codes([200])
    result = Failure("Check Status Route", http_validator,
                     description="Validation failure message")
    email_pub.send(result)
    assert len(smtpserver.outbox) == 1
    payload = str(smtpserver.outbox[0].get_payload()[0])
    assert payload.split("\n")[-1] == "Validation failure message"
Пример #2
0
def test_simple_email_repr(smtpserver):
    email_pub = SimpleEmailPublisher({"real_name": "test", "address": "*****@*****.**"},
                                     [{"real_name": "test", "address": "*****@*****.**"}],
                                     host=smtpserver.addr[0], port=smtpserver.addr[1])
    email_pub.__repr__()