2017-09-27 22:57:17 +00:00
|
|
|
|
"""
|
|
|
|
|
Test the functions in the `logger` module
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import pytest
|
2017-09-27 22:59:45 +00:00
|
|
|
|
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'
|
2017-09-27 22:59:45 +00:00
|
|
|
|
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 = '<>'
|
2017-09-27 22:59:45 +00:00
|
|
|
|
assert parse_log_line(line) == None
|
2017-09-27 22:57:17 +00:00
|
|
|
|
|
|
|
|
|
line = 'MR 20170908T07:05:04Z 003 <nick> '
|
2017-09-27 22:59:45 +00:00
|
|
|
|
assert vars(parse_log_line(line)) == vars(LogMessage('2017', '09', '08', '07', '05', '04', '003', 'nick', ''))
|