def test_server_with_its_loop_instance(): from pseud import SyncClient, Server endpoint = b'ipc:///tmp/test_socket' def start_server(can_stop): server = Server(b'a') server.bind(endpoint) server.register_rpc(str.lower) def stop_server(server, can_stop): can_stop.wait() server.stop() stop_thread = threading.Thread( target=functools.partial(stop_server, server, can_stop)) stop_thread.start() server.start() can_stop = threading.Event() server_thread = threading.Thread( target=functools.partial(start_server, can_stop)) server_thread.start() client = SyncClient() client.connect(endpoint) result = client.lower('TOTO') can_stop.set() assert result == 'toto'
def test_server_with_its_loop_instance(): from pseud import SyncClient, Server endpoint = b'ipc:///tmp/test_socket' def start_server(): server = Server(b'a') server.bind(endpoint) server.register_rpc(str.lower) server.io_loop.add_timeout(server.io_loop.time() + .2, server.stop) server.start() server_thread = threading.Thread(target=start_server) server_thread.start() client = SyncClient() client.connect(endpoint) result = client.lower('TOTO') assert result == 'toto'
def test_client_can_connect(): from pseud import SyncClient endpoint = 'inproc://{}'.format(__name__).encode() client = SyncClient() client.connect(endpoint) client.stop()
def test_client_creation(): from pseud import SyncClient client = SyncClient() assert client.security_plugin == 'noop_auth_backend'
def make_one_client(timeout=5): from pseud import SyncClient client = SyncClient(timeout=timeout) return client
def test_client_can_connect(loop): from pseud import SyncClient endpoint = 'inproc://{}'.format(__name__).encode() client = SyncClient() client.connect(endpoint) client.stop()
def test_client_can_bind(loop): from pseud import SyncClient endpoint = 'inproc://{}'.format(__name__).encode() client = SyncClient() client.bind(endpoint) client.stop()
def test_client_can_bind(): from pseud import SyncClient endpoint = 'inproc://{}'.format(__name__).encode() client = SyncClient() client.bind(endpoint) client.stop()