예제 #1
0
async def test_client_success():
    from elasticapm.contrib.asyncio import Client

    client = Client(
        server_url="http://localhost",
        service_name="service_name",
        secret_token="secret",
        transport_class=".".join((__name__, MockTransport.__name__)),
    )
    client.send(client.config.server_url, foo="bar")
    tasks = asyncio.Task.all_tasks()
    task = next(t for t in tasks if t is not asyncio.Task.current_task())
    await task
    assert client.state.status == 1
    transport = client._get_transport(urlparse("http://localhost"))
    assert transport.data == client.encode({"foo": "bar"})
예제 #2
0
async def test_client_success():
    from elasticapm.contrib.asyncio import Client

    client = Client(
        server_url='http://localhost',
        service_name='service_name',
        secret_token='secret',
        transport_class='.'.join((__name__, MockTransport.__name__)),
    )
    client.send(client.config.server_url, foo='bar')
    tasks = asyncio.Task.all_tasks()
    task = next(t for t in tasks if t is not asyncio.Task.current_task())
    await task
    assert client.state.status == 1
    transport = client._get_transport(urlparse('http://localhost'))
    assert transport.data == client.encode({'foo': 'bar'})