示例#1
0
def test_transport_works(httpserver, request, capsys):
    httpserver.serve_content("ok", 200)

    client = Client("http://foobar@{}/123".format(
        httpserver.url[len("http://"):]))
    Hub.current.bind_client(client)
    request.addfinalizer(lambda: Hub.current.bind_client(None))

    add_breadcrumb(level="info",
                   message="i like bread",
                   timestamp=datetime.now())
    capture_message("löl")
    client.close()

    out, err = capsys.readouterr()
    assert not err and not out
    assert httpserver.requests
示例#2
0
def test_transport_works(httpserver, request, capsys, caplog, debug):
    httpserver.serve_content("ok", 200)
    caplog.set_level(logging.DEBUG)

    client = Client(
        "http://foobar@{}/123".format(httpserver.url[len("http://") :]), debug=debug
    )
    Hub.current.bind_client(client)
    request.addfinalizer(lambda: Hub.current.bind_client(None))

    add_breadcrumb(level="info", message="i like bread", timestamp=datetime.now())
    capture_message("löl")
    client.close()

    out, err = capsys.readouterr()
    assert not err and not out
    assert httpserver.requests

    assert any("Sending info event" in record.msg for record in caplog.records) == debug