summaryrefslogtreecommitdiff
path: root/test/test_logger.py
blob: d0e2a89b6ba0a9e96a759fdc68904b583043e57f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
"""
Test the functions in the `logger` module
"""

import pytest
from poezio.logger import LogInfo, LogMessage, parse_log_line

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'))

    line = '<>'
    assert parse_log_line(line) == None

    line = 'MR 20170908T07:05:04Z 003 <nick>  '
    assert vars(parse_log_line(line)) == vars(LogMessage('2017', '09', '08', '07', '05', '04', '003', 'nick', ''))