Пример #1
0
 def test_sendrecv_request_message_with_datetime_in_list(self):
     """
     Test send/receive of an RequestMessage, containing a datetime in the list.
     """
     my_list = [round_to_millisecond_precision(datetime.utcnow()),round_to_millisecond_precision(datetime.utcnow())]
     self._test_sendrecv(RequestMessage(subject="my_request", reply_to=self.test_queue.address).with_args_kwargs(
                                        my_list=my_list))
Пример #2
0
 def test_sendrecv_request_message_with_large_content_map(self):
     """
     Test send/receive of an RequestMessage, containing a dict with a large string value.
     Qpid, cannot (de)serialize strings > 64k in a dict
     We circumvent this in ToBus.send and FromBus.receive by converting long strings in a dict to a buffer and back.
     """
     self._test_sendrecv(RequestMessage(subject="my_request",  reply_to=self.test_queue.address).with_args_kwargs(
                                        key1="short message", key2="long message " + (2 ** 17) * 'a'))
Пример #3
0
 def test_sendrecv_request_message_with_int_keys(self):
     """
     Test send/receive of an RequestMessage, containing int's as keys
     """
     my_dict = { 0: 'foo',
                 1: 'bar' }
     recv_msg = self._test_sendrecv(RequestMessage(subject="my_request",  reply_to=self.test_queue.address).with_args_kwargs(
                                                   my_dict=my_dict))
     self.assertEqual(my_dict, recv_msg.content['kwargs']['my_dict'])
Пример #4
0
    def test_sendrecv_request_message_with_large_string(self):
        """
        Test send/receive of an RequestMessage, containing a large string
        """
        large = ((2**16)+1)*'a' # test if the messages can handle a string with more than 2^16 chars which is aparently a probly for some brokers of messaging libs.
                                  # so, we need a large enough string, but not too big to overload the broker buffers when running multiple tests at the same time

        self._test_sendrecv(RequestMessage(subject="my_request", reply_to=self.test_queue.address).with_args_kwargs(
                                           my_string=large))
Пример #5
0
 def test_sendrecv_request_message_with_nested_dicts_and_lists_with_special_types(self):
     """
     Test send/receive of an RequestMessage, containing a datetimes in nested dicts/lists.
     """
     content = {'foo': [ {'timestamp1': round_to_millisecond_precision(datetime.utcnow()),
                          'timestamp2': round_to_millisecond_precision(datetime.utcnow()),
                          'foo': 'bar'},
                         {},
                         {'abc':[round_to_millisecond_precision(datetime.utcnow()), round_to_millisecond_precision(datetime.utcnow())]},
                         {'a': 'b',
                          'c': { 'timestamp': round_to_millisecond_precision(datetime.utcnow())}}],
                'bar': [],
                'large_string': ((2**16)+1)*'a' # test if the messages can handle a string with more than 2^16 chars which is aparently a probly for some brokers of messaging libs.
                                                # so, we need a large enough string, but not too big to overload the broker buffers when running multiple tests at the same time
                }
     self._test_sendrecv(RequestMessage(subject="my_request", reply_to=self.test_queue.address).with_args_kwargs(**content))
Пример #6
0
 def test_sendrecv_request_message(self):
     """
     Test send/receive of an RequestMessage, containing a byte array.
     """
     self._test_sendrecv(RequestMessage(subject="my_request",  reply_to=self.test_queue.address).with_args_kwargs(
                                        request="Do Something", argument="Very Often"))