personabot-api / tests /test_parser_config.py
GitHub Actions
Deploy 1ba9ba6
9563e4a
import os
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from ingestion.parser_config import load_parser_config
def test_parser_config_defaults_all_enabled(monkeypatch) -> None:
for key in (
"INGEST_ENABLE_BLOG_MDX",
"INGEST_ENABLE_PROJECT_MDX",
"INGEST_ENABLE_PDF",
"INGEST_ENABLE_GITHUB_README",
):
monkeypatch.delenv(key, raising=False)
cfg = load_parser_config()
assert cfg.enable_blog_mdx is True
assert cfg.enable_project_mdx is True
assert cfg.enable_pdf is True
assert cfg.enable_github_readme is True
def test_parser_config_can_disable_selective_parsers(monkeypatch) -> None:
monkeypatch.setenv("INGEST_ENABLE_BLOG_MDX", "false")
monkeypatch.setenv("INGEST_ENABLE_PROJECT_MDX", "true")
monkeypatch.setenv("INGEST_ENABLE_PDF", "0")
monkeypatch.setenv("INGEST_ENABLE_GITHUB_README", "yes")
cfg = load_parser_config()
assert cfg.enable_blog_mdx is False
assert cfg.enable_project_mdx is True
assert cfg.enable_pdf is False
assert cfg.enable_github_readme is True