Skip to content

Commit 76f7ea0

Browse files
author
Aviv Laufer
committed
Test config file reloading
1 parent a1fb864 commit 76f7ea0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

protoconfloader/protoconfloader.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ async def load_config(self, config_path: str, config_name: str) -> None:
8383
Loads the configuration from the specified file.
8484
"""
8585
if self.is_loaded:
86+
self.logger.info("Config file is already loaded")
8687
return
8788
self.config_file = os.path.join(config_path, config_name)
8889
try:

tests/test_protoconfloader.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@ async def test_load_config_local():
1616
return_value='{"crawlers": []}'
1717
)
1818
message = CrawlerService()
19-
config = Configuration(message, "test_service", logging.getLogger())
19+
mock_logger = MagicMock()
20+
config = Configuration(message, "test_service", mock_logger)
2021

2122
# Act
2223
await config.load_config("tests/test_data", "config.json")
2324

2425
assert message.log_level == 3
26+
await config.load_config("tests/test_data", "config.json")
27+
mock_logger.info.assert_called_once_with("Config file is already loaded")
2528

2629

2730
@pytest.mark.asyncio

0 commit comments

Comments
 (0)