def test_mailgun_sample(settings):
    settings.creds.update(
        {'mailgun': {
            'key': 'key',
            'domain': 'domain',
            'to': 'to',
        }})
    notify = notify_factory({
        'name': 'subject',
        'notify': [{
            'mailgun': {
                'to': 'me'
            }
        }]
    })
    with mock.patch.object(notify.notifiers[0], "session") as fake_session:
        notify('report')
        fake_session.post.assert_called_once_with(
            'https://api.mailgun.net/v3/domain/messages',
            data={
                'to': ['me'],
                'text': 'report',
                'from': 'Kibitzr <mailgun@domain>',
                'subject': 'Kibitzr update for subject',
            })
Example #2
0
def test_config_is_passed(fake_send_email, settings):
    settings.creds.update({
        'smtp': {
            'user': '******',
            'password': '******',
            'host': 'host',
            'port': 'port',
        }
    })
    notifier = notify_factory({
        'name': 'subject',
        'notify': [{
            'smtp': '*****@*****.**'
        }]
    })
    notifier.notify('report', )
    fake_send_email.assert_called_once_with(
        user='******',
        password='******',
        recipients=['*****@*****.**'],
        subject='Kibitzr update for subject',
        body='report',
        host='host',
        port='port',
    )
Example #3
0
def test_mailgun_sample(fake_session, settings):
    settings.creds.update(
        {'mailgun': {
            'key': 'key',
            'domain': 'domain',
            'to': 'to',
        }})
    notify_func = notify_factory({
        'name': 'subject',
        'notify': [{
            'mailgun': {
                'to': 'me'
            }
        }]
    })
    notify_func('report')
    fake_session.return_value.post.assert_called_once_with(
        'https://api.mailgun.net/v3/domain/messages',
        data={
            'to': ['me'],
            'text': 'report',
            'from': 'Kibitzr <mailgun@domain>',
            'subject': 'Kibitzr update for subject',
        })
Example #4
0
def make_stash(**kwargs):
    return notify_factory({'notify': [{'stash': dict(**kwargs)}]})