summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2017-09-28 00:57:17 +0200
committermathieui <mathieui@mathieui.net>2017-09-28 00:57:17 +0200
commit444af2be6f4a4bce2bb5cfc8a7fe80ab95ca8d49 (patch)
tree8517d417cf73353ebe2606031e64143842c24435 /test
parent9f7041f65e5cd345fa894bfbbb6e9235260d9c33 (diff)
downloadpoezio-444af2be6f4a4bce2bb5cfc8a7fe80ab95ca8d49.tar.gz
poezio-444af2be6f4a4bce2bb5cfc8a7fe80ab95ca8d49.tar.bz2
poezio-444af2be6f4a4bce2bb5cfc8a7fe80ab95ca8d49.tar.xz
poezio-444af2be6f4a4bce2bb5cfc8a7fe80ab95ca8d49.zip
Add a simple test case
Diffstat (limited to 'test')
-rw-r--r--test/test_logger.py16
1 files changed, 16 insertions, 0 deletions
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 <nick>  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 <nick>  '
+ assert vars(parse_message_line(line)) == vars(LogMessage('2017', '09', '08', '07', '05', '04', '003', 'nick', ''))