Example #1
0
 def test_rpc_properties(self):
     """Test setup rpc properties.  """
     c = RpcClient(client_queue='whatever.client')
     c._send_command = MagicMock()
     c.retrieve_messages = MagicMock()
     c.rpc('whatever', {"data": "x"})
     c._send_command.assert_called_with(
         ANY,
         'whatever',
         {
             "reply_to": "whatever.client",
             "correlation_id": ANY
         }
     )
     # This part shouldn't matter if legacy or not.
     c = RpcClient(client_queue='test.my.queue')
     c._send_command = MagicMock()
     c.retrieve_messages = MagicMock()
     c.rpc('whatever', {"data": "x"})
     c._send_command.assert_called_with(
         ANY,
         'whatever',
         {
             "reply_to": "test.my.queue",
             "correlation_id": ANY
         }
     )
Example #2
0
 def test_payload_standard_rpc(self):
     """Test command for standard RPC."""
     c = RpcClient()
     c._send_command = MagicMock()
     c.retrieve_messages = MagicMock()
     call_payload = {"test": 2}
     c.rpc('do_that', call_payload)
     c._send_command.assert_called_with(call_payload,
                                        'do_that',  # routing key
                                        ANY)  # properties
Example #3
0
 def test_rpc_properties(self):
     """Test setup rpc properties.  """
     c = RpcClient(client_queue='whatever.client')
     c._send_command = MagicMock()
     c.retrieve_messages = MagicMock()
     c.rpc('whatever', {"data": "x"})
     c._send_command.assert_called_with(ANY, 'whatever', {
         "reply_to": "whatever.client",
         "correlation_id": ANY
     })
     # This part shouldn't matter if legacy or not.
     c = RpcClient(client_queue='test.my.queue')
     c._send_command = MagicMock()
     c.retrieve_messages = MagicMock()
     c.rpc('whatever', {"data": "x"})
     c._send_command.assert_called_with(ANY, 'whatever', {
         "reply_to": "test.my.queue",
         "correlation_id": ANY
     })
Example #4
0
 def test_payload_standard_rpc(self):
     """Test command for standard RPC."""
     c = RpcClient()
     c._send_command = MagicMock()
     c.retrieve_messages = MagicMock()
     call_payload = {"test": 2}
     c.rpc('do_that', call_payload)
     c._send_command.assert_called_with(
         call_payload,
         'do_that',  # routing key
         ANY)  # properties