Skip to content

Commit 9f90ca9

Browse files
committed
fix: update unittest for configure_console_logger to accept logger_config argument
1 parent 4e4a983 commit 9f90ca9

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

tests/utils/test_logger.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
from pyproxy.utils.logger import configure_console_logger, configure_file_logger
1313

1414

15+
class DummyLoggerConfig:
16+
def __init__(self, console_format=None, datefmt=None):
17+
self.console_format = console_format or "%(log_color)s%(asctime)s - %(levelname)s - %(message)s"
18+
self.datefmt = datefmt or "%d/%m/%Y %H:%M:%S"
19+
20+
1521
class TestLogger(unittest.TestCase):
1622
"""
1723
Test suite for the logger module.
@@ -26,7 +32,8 @@ def test_configure_console_logger(self, mock_stdout):
2632
- Checks that the log level is set to INFO.
2733
- Verifies that the handler is a StreamHandler.
2834
"""
29-
logger = configure_console_logger()
35+
logger_config = DummyLoggerConfig()
36+
logger = configure_console_logger(logger_config)
3037

3138
self.assertTrue(logger.hasHandlers())
3239
self.assertEqual(logger.level, logging.INFO)

0 commit comments

Comments
 (0)