Exemplo n.º 1
0
def test_advertise_should_take_a_router_file(router_file):
    from tchannel.tornado.response import Response as TornadoResponse

    tchannel = TChannel(name='client')
    with open(router_file, 'r') as json_data:
        routers = json.load(json_data)

    with (patch(
            'tchannel.tornado.TChannel.advertise',
            autospec=True,
    )) as mock_advertise:
        f = gen.Future()
        mock_advertise.return_value = f
        f.set_result(TornadoResponse())
        tchannel.advertise(router_file=router_file)

        mock_advertise.assert_called_once_with(ANY,
                                               routers=routers,
                                               name=ANY,
                                               timeout=ANY)
Exemplo n.º 2
0
 def new_advertise(*args, **kwargs):
     f = gen.Future()
     f.set_result(
         TornadoResponse(
             argstreams=[closed_stream(b'{}') for i in range(3)], ))
     return f