poezio/test/test_logger.py

17 lines
546 B
Python
Raw Normal View History

2017-09-27 22:57:17 +00:00
"""
Test the functions in the `logger` module
"""
import pytest
from poezio.logger import LogInfo, LogMessage, parse_log_line
2017-09-27 22:57:17 +00:00
def test_parse_message():
line = 'MR 20170909T09:09:09Z 000 <nick>  body'
assert vars(parse_log_line(line)) == vars(LogMessage('2017', '09', '09', '09', '09', '09', '0', 'nick', 'body'))
2017-09-27 22:57:17 +00:00
line = '<>'
assert parse_log_line(line) == None
2017-09-27 22:57:17 +00:00
line = 'MR 20170908T07:05:04Z 003 <nick>  '
assert vars(parse_log_line(line)) == vars(LogMessage('2017', '09', '08', '07', '05', '04', '003', 'nick', ''))