How to use the kibitzr.notifier.smtp.notify function in kibitzr

To help you get started, we’ve selected a few kibitzr 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 kibitzr / kibitzr / tests / unit / notifiers / test_smtp.py View on Github external
def test_smtp_explicit_form(fake_smtp, settings):
    settings.creds.update({
        'smtp': {
            'user': 'user',
            'password': 'password',
            'host': 'host',
            'port': 'port',
        }
    })
    smtp.notify(
        {'name': 'Name'},
        'report',
        {'recipients': ['you@site.com'], 'subject': 'subject'},
    )
    fake_smtp.assert_called_once_with('host', 'port')
    fake_smtp.return_value.login.assert_called_once_with('user', 'password')
    fake_smtp.return_value.sendmail.assert_called_once_with(
        'user',
        ['you@site.com'],
        b'From: user\r\nTo: you@site.com\r\nSubject: subject\r\n\r\nreport\r\n',
    )
github kibitzr / kibitzr / tests / unit / notifiers / test_smtp.py View on Github external
def test_smtp_uses_local_server_by_default(fake_smtp, settings):
    settings.creds.pop('smtp', None)
    smtp.notify(
        {'name': 'Name'},
        'report',
        'you@site.com',
    )
    fake_smtp.assert_called_once_with('localhost', 25)
    fake_smtp.return_value.login.assert_called_once_with('you@site.com', '')
    fake_smtp.return_value.sendmail.assert_called_once_with(
        'you@site.com',
        ['you@site.com'],
        b'From: you@site.com\r\nTo: you@site.com\r\n'
        b'Subject: Kibitzr update for Name\r\n\r\nreport\r\n',
github kibitzr / kibitzr / tests / unit / notifiers / test_smtp.py View on Github external
def test_smtp_shortcut(fake_send_email, settings):
    settings.creds.update({
        'smtp': {
            'user': 'user',
            'password': 'password',
            'host': 'host',
            'port': 'port',
        }
    })
    smtp.notify({'name': 'Name'}, 'report', 'you@site.com')
    fake_send_email.assert_called_once_with(
        user='user',
        password='password',
        recipients=['you@site.com'],
        subject='Kibitzr update for Name',
        body='report',
        host='host',
        port='port',
    )