Beispiel #1
0
def test_client_uses_sync_mode_when_master_process(is_master_process):
    # when in the master process, the client should use the non-async
    # HTTP transport, even if async_mode is True
    is_master_process.return_value = True
    client = Client(server_url="http://example.com",
                    service_name="app_name",
                    secret_token="secret",
                    async_mode=True)
    transport = client._get_transport(
        compat.urlparse.urlparse("http://exampe.com"))
    assert transport.async_mode is False
 def test_client_uses_sync_mode_when_master_process(self,
                                                    is_master_process):
     # when in the master process, the client should use the non-async
     # HTTP transport, even if async_mode is True
     is_master_process.return_value = True
     client = Client(
         servers=['http://example.com'],
         app_name='app_name',
         secret_token='secret',
         async_mode=True,
     )
     self.assertIsInstance(
         client._get_transport(urlparse.urlparse('http://exampe.com')),
         HTTPTransport)