Refactor AI daily report pipeline
This commit is contained in:
27
tests/test_config_loading.py
Normal file
27
tests/test_config_loading.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from ai_daily_report.config import load_source_configs
|
||||
from ai_daily_report.sources.registry import get_source_fetcher
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
class ConfigLoadingTests(unittest.TestCase):
|
||||
def test_load_source_configs_from_json(self):
|
||||
configs = load_source_configs(ROOT / "config" / "sources.json")
|
||||
|
||||
self.assertGreaterEqual(len(configs), 5)
|
||||
self.assertEqual(configs[0].name, "AI HOT")
|
||||
self.assertEqual(configs[0].type, "aihot")
|
||||
|
||||
def test_all_configured_source_types_are_registered(self):
|
||||
configs = load_source_configs(ROOT / "config" / "sources.json")
|
||||
|
||||
for config in configs:
|
||||
self.assertTrue(callable(get_source_fetcher(config.type)))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user