def test_doc():
    failed_count, tests = doctest.testmod(foreman_log,
        globs={
            "cp_log": CandlepinLog(context_wrap(CANDLEPIN_LOG)),
            "candlepin_log": CandlepinErrorLog(context_wrap(CANDLEPIN_ERROR_LOG)),
            "foreman_ssl_acess_log": ForemanSSLAccessLog(context_wrap(FOREMAN_SSL_ACCESS_SSL_LOG))
        }
    )
    assert failed_count == 0
Exemple #2
0
def test_candlepin_error_log():
    error_log = CandlepinErrorLog(context_wrap(CANDLEPIN_ERROR_LOG))
    assert "req=d9dc3cfd-abf7-485e-b1eb-e1e28e4b0f28" in error_log
    assert len(error_log.get("req=d9dc3cfd-abf7-485e-b1eb-e1e28e4b0f28")) == 3
    assert len(list(error_log.get_after(datetime(2016, 9, 7, 18, 7, 53)))) == 3
    assert len(list(error_log.get_after(datetime(2016, 9, 7, 16, 0, 0)))) == 4