from pathlib import Path from graphrag_platform.config import Settings def test_settings_parse_runtime_templates(monkeypatch) -> None: monkeypatch.setenv("ENTITY_TYPES", "Company,Product") monkeypatch.setenv("RELATIONSHIP_TYPES", "CREATED,DEPENDS_ON") monkeypatch.setenv("NODE_TEMPLATE", '{"name":"string"}') settings = Settings(_env_file=None) assert settings.entity_types == ["Company", "Product"] assert settings.relationship_types == ["CREATED", "DEPENDS_ON"] assert settings.node_template == {"name": "string"} assert settings.database_url.startswith("postgresql+psycopg://") def test_sqlite_is_available_as_explicit_local_override(tmp_path: Path) -> None: settings = Settings( _env_file=None, database_url=f"sqlite:///{tmp_path / 'graph.db'}", ) assert settings.database_url.startswith("sqlite:///")