Ejemplo n.º 1
0
def test_include_raw():
    path = os.path.join(DATA_DIR, "test1.log")
    with open(path) as file:
        assert all("raw" in r for r in parse_stream(file, include_raw=True))
    with open(path) as file:
        assert all("raw" not in r
                   for r in parse_stream(file, include_raw=False))
    with open(path) as file:
        assert all("raw" not in r for r in parse_stream(file))
Ejemplo n.º 2
0
def test_parsing_file():
    path = os.path.join(DATA_DIR, "test1.log")
    with open(path) as file:
        result = list(parse_stream(file, include_raw=True))
    with open(os.path.join(DATA_DIR, "test1_expected.json")) as expected_file:
        expected = json.load(expected_file)
    assert expected == result
Ejemplo n.º 3
0
def test_werkzeug():
    path = os.path.join(DATA_DIR, "test_werkzeug.log")
    with open(path) as file:
        result = list(enrich_werkzeug(parse_stream(file)))
    with open(os.path.join(DATA_DIR,
                           "test_werkzeug_expected.json")) as expected_file:
        expected = json.load(expected_file)
    assert expected == result
Ejemplo n.º 4
0
def test_empty():
    path = os.path.join(DATA_DIR, "empty.log")
    with open(path) as file:
        assert list(parse_stream(file)) == []