コード例 #1
0
ファイル: test_client.py プロジェクト: heytrav/rabbit-qurator
 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
         }
     )
コード例 #2
0
ファイル: test_client.py プロジェクト: heytrav/rabbit-qurator
 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
コード例 #3
0
ファイル: test_client.py プロジェクト: heytrav/rabbit-qurator
 def test_task_properties(self):
     """Setup task properties."""
     c = RpcClient()
     c._send_command = MagicMock()
     c.task('whatever', {"data": "x"})
     c._send_command.assert_called_with(ANY,
                                        'whatever',
                                        declare_queue=False)
     # This part shouldn't matter if legacy or not.
     c = RpcClient(client_queue='test.my.queue')
     c._send_command = MagicMock()
     c.task('whatever', {"data": "x"})
     c._send_command.assert_called_with(ANY,
                                        'whatever',
                                        declare_queue=False)
コード例 #4
0
ファイル: test_client.py プロジェクト: heytrav/rabbit-qurator
 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
コード例 #5
0
ファイル: test_client.py プロジェクト: heytrav/rabbit-qurator
 def test_task_properties(self):
     """Setup task properties."""
     c = RpcClient()
     c._send_command = MagicMock()
     c.task('whatever', {"data": "x"})
     c._send_command.assert_called_with(
         ANY,
         'whatever',
         declare_queue=False
     )
     # This part shouldn't matter if legacy or not.
     c = RpcClient(client_queue='test.my.queue')
     c._send_command = MagicMock()
     c.task('whatever', {"data": "x"})
     c._send_command.assert_called_with(
         ANY,
         'whatever',
         declare_queue=False
     )
コード例 #6
0

from kombu import Exchange
from qurator.rpc.client import RpcClient

if __name__ == '__main__':
    client = RpcClient()
    reply = client.rpc('personal_handle', 
               {"handles": {"personal":{'id': '001bffe546d6705f4e004a80e30769bd'}}},
               server_routing_key='api.handle')
    print("Got reply: {!r}".format(reply))



コード例 #7
0
from kombu import Exchange
from qurator.rpc.client import RpcClient

if __name__ == '__main__':
    client = RpcClient()
    reply = client.rpc(
        'personal_handle',
        {"handles": {
            "personal": {
                'id': '001bffe546d6705f4e004a80e30769bd'
            }
        }},
        server_routing_key='api.handle')
    print("Got reply: {!r}".format(reply))
コード例 #8
0
from qurator.rpc.client import RpcClient

if __name__ == '__main__':
    client = RpcClient()
    reply = client.rpc('account_handle', 
               {'account': '4084a589401ebe665c313edecf0066a0'},
               server_routing_key='api.account')
    print("Got reply: {!r}".format(reply))



コード例 #9
0
import time
from qurator.rpc.client import RpcClient

if __name__ == '__main__':
    client = RpcClient()
    reply = client.rpc('account_for_domain',
                       {'domains': [{
                           "domain": 'booma.wang'
                       }]},
                       server_routing_key='api.account')
    print("Got reply: {!r}".format(reply))
コード例 #10
0
from qurator.rpc.client import RpcClient

if __name__ == '__main__':
    client = RpcClient()
    reply = client.rpc('account_handle',
                       {'account': '1bb0db05cf3b6e6ee5ec9fcce978b0a2'},
                       server_routing_key='api.account')
    print("Got reply: {!r}".format(reply))
コード例 #11
0
from qurator.rpc.client import RpcClient

if __name__ == "__main__":
    client = RpcClient()
    reply = client.rpc(
        "account_handle", {"account": "1bb0db05cf3b6e6ee5ec9fcce978b0a2"}, server_routing_key="api.account"
    )
    print("Got reply: {!r}".format(reply))
コード例 #12
0
import time
from qurator.rpc.client import RpcClient

if __name__ == '__main__':
    client = RpcClient()
    reply = client.rpc('account_for_domain',
                       {'domains': [{
                           "domain": '1405573374-test.com'
                       }]},
                       server_routing_key='api.account')
    print("Got reply: {!r}".format(reply))
コード例 #13
0
from qurator.rpc.client import RpcClient

if __name__ == '__main__':
    client = RpcClient()
    reply = client.rpc('account_handle',
                       {'account': '4084a589401ebe665c313edecf0066a0'},
                       server_routing_key='api.account')
    print("Got reply: {!r}".format(reply))
コード例 #14
0
ファイル: mailer_test.py プロジェクト: heytrav/rabbit-qurator
import time
from kombu import Exchange as task_exchange
from qurator.rpc.client import RpcClient

if __name__ == '__main__':
    client = RpcClient(exchange=task_exchange)
    reply = client.task('missing_handle', 
               {'user_id': "4084a589401ebe665c313edecf001fcb"},
               server_routing_key='api.mailer')
    print("Got reply: {!r}".format(reply))



コード例 #15
0
import time
from kombu import Exchange as task_exchange
from qurator.rpc.client import RpcClient

if __name__ == '__main__':
    client = RpcClient(exchange=task_exchange)
    reply = client.task('missing_handle',
                        {'user_id': "4084a589401ebe665c313edecf001fcb"},
                        server_routing_key='api.mailer')
    print("Got reply: {!r}".format(reply))
コード例 #16
0
import time
from qurator.rpc.client import RpcClient

if __name__ == '__main__':
    client = RpcClient()
    reply = client.rpc('account_for_domain', 
               {'domains': [{"domain":'1405573374-test.com'}]},
               server_routing_key='api.account')
    print("Got reply: {!r}".format(reply))



コード例 #17
0
import time
from qurator.rpc.client import RpcClient

if __name__ == '__main__':
    client = RpcClient()
    reply = client.rpc('account_for_domain', 
               {'domains': [{"domain":'booma.wang'}]},
               server_routing_key='api.account')
    print("Got reply: {!r}".format(reply))



コード例 #18
0
ファイル: test_client.py プロジェクト: heytrav/rabbit-qurator
 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
     })