Added custom log function; started tests
Some checks failed
continuous-integration/drone the build failed

This commit is contained in:
Jef Roosens 2021-04-26 22:34:12 +02:00
parent 8520b09c4e
commit 8929d743e9
Signed by: Jef Roosens
GPG key ID: B580B976584B5F30
3 changed files with 52 additions and 9 deletions

23
tests/test_logger.py Normal file
View file

@ -0,0 +1,23 @@
"""Tests for the logger module."""
from app.logger import Logger
from datetime import datetime
def test_custom_stdout(capfd):
"""Test the custom command."""
logger = Logger()
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
logger.custom("a message", header="cewl")
out, _ = capfd.readouterr()
assert out == f"[{timestamp}][cewl] a message\n"
def test_log_stdout(capfd):
"""Test the log command with several levels."""
logger = Logger()
# TODO