backup-tool/tests/test_logger.py

24 lines
497 B
Python
Raw Normal View History

"""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