def test_that_send_simple_message_creates_the_appropriate_request(self):
domain = 'domain'
api_key = 'APIKEY'
sender_name = 'foo'
mailer = Mailer(domain, api_key, sender_name)
with mock.patch('requests.post') as mock_post:
data = {'subject': 'foo'}
mailer.send_simple_message(data)
expected_data = data.copy()
expected_data['from'] = mailer.sender
mock_post.assert_called_once_with("%s/messages" % mailer.api_url,
auth=mailer.auth,
data=expected_data)
评论列表
文章目录