Added custom log function; started tests
Some checks failed
continuous-integration/drone the build failed
Some checks failed
continuous-integration/drone the build failed
This commit is contained in:
parent
8520b09c4e
commit
8929d743e9
3 changed files with 52 additions and 9 deletions
23
tests/test_logger.py
Normal file
23
tests/test_logger.py
Normal 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
|
||||
Reference in a new issue