Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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'
)
'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)