From 444af2be6f4a4bce2bb5cfc8a7fe80ab95ca8d49 Mon Sep 17 00:00:00 2001 From: mathieui Date: Thu, 28 Sep 2017 00:57:17 +0200 Subject: Add a simple test case --- test/test_logger.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 test/test_logger.py (limited to 'test') diff --git a/test/test_logger.py b/test/test_logger.py new file mode 100644 index 00000000..40257536 --- /dev/null +++ b/test/test_logger.py @@ -0,0 +1,16 @@ +""" +Test the functions in the `logger` module +""" + +import pytest +from poezio.logger import LogInfo, LogMessage, parse_message_line + +def test_parse_message(): + line = 'MR 20170909T09:09:09Z 000  body' + assert vars(parse_message_line(line)) == vars(LogMessage('2017', '09', '09', '09', '09', '09', '0', 'nick', 'body')) + + line = '<>' + assert parse_message_line(line) == None + + line = 'MR 20170908T07:05:04Z 003  ' + assert vars(parse_message_line(line)) == vars(LogMessage('2017', '09', '08', '07', '05', '04', '003', 'nick', '')) -- cgit v1.2.3