def test_candlepin_log(): cp_log = CandlepinLog(context_wrap(CANDLEPIN_LOG)) assert "req=49becd26-5dfe-4d2f-8667-470519230d88" in cp_log assert len(cp_log.get("req=bd5a4284-d280-4fc5-a3d5-fc976b7aa5cc")) == 2 # https://github.com/RedHatInsights/insights-core/pull/2641 # assert len(list(cp_log.get_after(datetime(2016, 9, 9, 13, 45, 53)))) == 2 assert cp_log.get("req=bd5a4284-d280-4fc5-a3d5-fc976b7aa5cc")[0]['timestamp'] == datetime(2016, 9, 9, 13, 45, 52, 650000)
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
def test_candlepin_log(): cp_log = CandlepinLog(context_wrap(CANDLEPIN_LOG)) assert "req=49becd26-5dfe-4d2f-8667-470519230d88" in cp_log assert len(cp_log.get("req=bd5a4284-d280-4fc5-a3d5-fc976b7aa5cc")) == 2 assert len(list(cp_log.get_after(datetime(2016, 9, 9, 13, 45, 53)))) == 2