示例#1
0
    def test_caching_bad_message_ids(self, mock_sfmc):
        """Bad message IDs are cached so we don't try to send to them again"""
        exc = NewsletterException()
        exc.message = 'Invalid Customer Key'
        mock_sfmc.send_mail.side_effect = exc

        message_id = "MESSAGE_ID"
        for i in range(10):
            send_message(message_id, 'email', 'token', 'format')

        mock_sfmc.send_mail.assert_called_once_with(message_id, 'email', 'token', None)
示例#2
0
    def test_caching_bad_message_ids(self, mock_sfmc):
        """Bad message IDs are cached so we don't try to send to them again"""
        exc = NewsletterException()
        exc.message = 'Invalid Customer Key'
        mock_sfmc.send_mail.side_effect = exc

        message_id = "MESSAGE_ID"
        for i in range(10):
            send_message(message_id, 'email', 'token', 'format')

        mock_sfmc.send_mail.assert_called_once_with(message_id, 'email', 'token', 'format')
示例#3
0
    def test_caching_bad_message_ids(self, mock_ExactTarget):
        """Bad message IDs are cached so we don't try to send to them again"""
        mock_et = mock_ExactTarget()
        exc = NewsletterException()
        exc.message = 'Invalid Customer Key'
        mock_et.trigger_send.side_effect = exc

        message_id = "MESSAGE_ID"
        # Should only raise BaseketError once
        with self.assertRaises(BasketError):
            send_message(message_id, 'email', 'token', 'format')
        send_message(message_id, 'email', 'token', 'format')
示例#4
0
    def test_caching_bad_message_ids(self, mock_ExactTarget):
        """Bad message IDs are cached so we don't try to send to them again"""
        mock_et = mock_ExactTarget()
        exc = NewsletterException()
        exc.message = 'Invalid Customer Key'
        mock_et.trigger_send.side_effect = exc

        message_id = "MESSAGE_ID"
        for i in range(10):
            send_message(message_id, 'email', 'token', 'format')

        mock_et.trigger_send.assert_called_once_with('MESSAGE_ID', {
            'EMAIL_ADDRESS_': 'email',
            'TOKEN': 'token',
            'EMAIL_FORMAT_': 'format',
        })