24 lines
497 B
Python
24 lines
497 B
Python
"""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
|