How to use the sparkpost.transmissions.Transmissions.send.assert_called_with function in sparkpost

To help you get started, we’ve selected a few sparkpost 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 SparkPost / python-sparkpost / test / django / test_email_backend.py View on Github external
def test_params():
    recipients = ['to1@example.com', 'to2@example.com']
    with mock.patch.object(Transmissions, 'send'):
        mailer(get_params(
            {'recipient_list': recipients,
             'fail_silently': True
             }
        ))

        Transmissions.send.assert_called_with(recipients=recipients,
                                              text='test body',
                                              from_email='from@example.com',
                                              subject='test subject'
                                              )
github SparkPost / python-sparkpost / test / django / test_email_backend.py View on Github external
'track_opens': False,
        'track_clicks': False,
        'transactional': True,
    }

    reconfigure_settings(SPARKPOST_OPTIONS=SPARKPOST_OPTIONS)

    with mock.patch.object(Transmissions, 'send'):
        mailer(get_params())
        expected_kargs = get_params().copy()
        expected_kargs["text"] = expected_kargs["message"]
        expected_kargs["recipients"] = expected_kargs["recipient_list"]
        del expected_kargs["message"]
        del expected_kargs["recipient_list"]
        expected_kargs.update(SPARKPOST_OPTIONS)
        Transmissions.send.assert_called_with(**expected_kargs)