diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2019-02-07 02:31:15 +0100 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2019-02-07 02:31:15 +0100 |
commit | e5e0533b6e355482f68592de1bff7e4af8f482ca (patch) | |
tree | c2f5061988fd6ec326184374ebc6652a4218825a /test/test_logger.py | |
parent | 42b87268b39557aa4cd0bac11f7d2bc760dbd38f (diff) | |
download | poezio-e5e0533b6e355482f68592de1bff7e4af8f482ca.tar.gz poezio-e5e0533b6e355482f68592de1bff7e4af8f482ca.tar.bz2 poezio-e5e0533b6e355482f68592de1bff7e4af8f482ca.tar.xz poezio-e5e0533b6e355482f68592de1bff7e4af8f482ca.zip |
logger: Log the JID during a parsing error.
Diffstat (limited to 'test/test_logger.py')
-rw-r--r-- | test/test_logger.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/test_logger.py b/test/test_logger.py index f1851d60..09ba720e 100644 --- a/test/test_logger.py +++ b/test/test_logger.py @@ -7,13 +7,13 @@ from poezio.common import get_utc_time, get_local_time 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')) + assert vars(parse_log_line(line, 'user@domain')) == vars(LogMessage('2017', '09', '09', '09', '09', '09', '0', 'nick', 'body')) line = '<>' - assert parse_log_line(line) is None + assert parse_log_line(line, 'user@domain') is None line = 'MR 20170908T07:05:04Z 003 <nick> ' - assert vars(parse_log_line(line)) == vars(LogMessage('2017', '09', '08', '07', '05', '04', '003', 'nick', '')) + assert vars(parse_log_line(line, 'user@domain')) == vars(LogMessage('2017', '09', '08', '07', '05', '04', '003', 'nick', '')) def test_log_and_parse_messages(): @@ -27,7 +27,7 @@ def test_log_and_parse_messages(): msg2_utc = get_utc_time(msg2['date']) assert built_msg2 == 'MR %s 001 <toto> coucou\n coucou\n' % (msg2_utc.strftime('%Y%m%dT%H:%M:%SZ')) - assert parse_log_lines((built_msg1 + built_msg2).split('\n')) == [ + assert parse_log_lines((built_msg1 + built_msg2).split('\n'), 'user@domain') == [ {'time': msg1['date'], 'history': True, 'txt': '\x195,-1}coucou', 'nickname': 'toto'}, {'time': msg2['date'], 'history': True, 'txt': '\x195,-1}coucou\ncoucou', 'nickname': 'toto'}, ] |