Ejemplo n.º 1
0
 def test_when_payload_list_is_empty(self):
     base = BaseDispatcher('test_subject',
                           'send_lots',
                           'send_one',
                           max_batch_size=1)
     base._aws_service_message_max_bytes = 15
     base._aws_service_batch_max_bytes = 15
     base._append_payload_to_current_batch = Mock()
     base._flush_payload_selector = Mock()
     pl = {"a": True}
     base.submit_payload(pl)
     base._append_payload_to_current_batch.assert_called_once_with(pl)
     base._flush_payload_selector.assert_called_once()
Ejemplo n.º 2
0
 def test_when_payload_is_over_byte_size(self):
     base = BaseDispatcher('test_subject',
                           'send_lots',
                           'send_one',
                           max_batch_size=1)
     base._aws_service_message_max_bytes = 10
     base._aws_service_batch_max_bytes = 15
     base._append_payload_to_current_batch = Mock()
     base._flush_payload_selector = Mock()
     pl = {"a": True}
     with self.assertRaises(ValueError) as context:
         base.submit_payload(pl)
     self.assertIn("exceeds the maximum payload size",
                   str(context.exception))
     base._append_payload_to_current_batch.assert_not_called()
     base._flush_payload_selector.assert_not_called()