Refactor AI daily report pipeline
This commit is contained in:
33
tests/test_dry_run_config.py
Normal file
33
tests/test_dry_run_config.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import importlib.util
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
SCRIPT = ROOT / "script" / "ai_daily_blog_pipeline.py"
|
||||
|
||||
|
||||
def load_pipeline_module():
|
||||
spec = importlib.util.spec_from_file_location("ai_daily_blog_pipeline", SCRIPT)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
return module
|
||||
|
||||
|
||||
class DryRunConfigTests(unittest.TestCase):
|
||||
def test_dry_run_does_not_require_blog_token(self):
|
||||
module = load_pipeline_module()
|
||||
|
||||
self.assertTrue(module.is_dry_run({"AI_DAILY_DRY_RUN": "1"}))
|
||||
self.assertFalse(module.requires_blog_token({"AI_DAILY_DRY_RUN": "1"}))
|
||||
|
||||
def test_publish_mode_requires_blog_token(self):
|
||||
module = load_pipeline_module()
|
||||
|
||||
self.assertFalse(module.is_dry_run({}))
|
||||
self.assertTrue(module.requires_blog_token({}))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user