def test_extract_utc_timestamp_from_log_line_when_invalid_date_format(): line = 'Jul 22 10:39:08 this is a fake invalid syslog message' assert not logs.extract_utc_timestamp_from_log_line(line)
def test_extract_utc_timestamp_from_log_line_when_missing_date(): line = 'this is a fake invalid syslog message' assert not logs.extract_utc_timestamp_from_log_line(line)
def test_extract_utc_timestamp_from_log_line_ok(): fake_timestamp = '2015-07-22T10:38:46-07:00' fake_utc_timestamp = isodate.parse_datetime('2015-07-22T17:38:46.000000') line = '%s this is a fake syslog test message' % fake_timestamp assert logs.extract_utc_timestamp_from_log_line(line) == fake_utc_timestamp