Beispiel #1
0
def test_send_email(app):
    recipients = ['*****@*****.**']
    with mail.record_messages() as outbox:
        send_email('foo', 'bar', '<div>bar</div>', recipients)
        assert len(outbox) == 1
        assert outbox[0].subject == 'foo'
        assert outbox[0].body == 'bar'
        assert outbox[0].html == '<div>bar</div>'
Beispiel #2
0
def test_send_email(app):
    recipients = ['*****@*****.**']
    with mail.record_messages() as outbox:
        send_email('foo', 'bar', '<div>bar</div>', recipients)
        assert len(outbox) == 1
        assert outbox[0].subject == 'foo'
        assert outbox[0].body == 'bar'
        assert outbox[0].html == '<div>bar</div>'
Beispiel #3
0
def test_send_invalid_email(app):
    recipients = ['*****@*****.**']
    with pytest.raises(Exception):
        send_email(None, 'bar', '<div>bar</div>', recipients)
        send_email('', 'bar', '<div>bar</div>', recipients)
        send_email('foo', None, '<div>bar</div>', recipients)
        send_email('foo', '', '<div>bar</div>', recipients)
Beispiel #4
0
def test_send_invalid_email(app):
    recipients = ['*****@*****.**']
    with pytest.raises(Exception):
        send_email(None, 'bar', '<div>bar</div>', recipients)
        send_email('', 'bar', '<div>bar</div>', recipients)
        send_email('foo', None, '<div>bar</div>', recipients)
        send_email('foo', '', '<div>bar</div>', recipients)