Files
LandPPT/tests/test_api_docs_config.py
T
sligter 6153e56441 feat: modularize services and expand platform workflows
Add OAuth, community, credits, startup, export, and narration workflows while splitting oversized route and PPT service modules into dedicated components with broader regression coverage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 21:04:37 +08:00

33 lines
912 B
Python

import importlib
import sys
def _reload_main_module(monkeypatch, enabled: bool):
from landppt.core.config import app_config
monkeypatch.setattr(app_config, "enable_api_docs", enabled)
sys.modules.pop("landppt.main", None)
return importlib.import_module("landppt.main")
def test_main_app_enables_api_docs_by_default(monkeypatch):
pytest = __import__("pytest")
pytest.importorskip("fastapi")
module = _reload_main_module(monkeypatch, True)
assert module.app.docs_url == "/docs"
assert module.app.redoc_url == "/redoc"
assert module.app.openapi_url == "/openapi.json"
def test_main_app_can_disable_api_docs(monkeypatch):
pytest = __import__("pytest")
pytest.importorskip("fastapi")
module = _reload_main_module(monkeypatch, False)
assert module.app.docs_url is None
assert module.app.redoc_url is None
assert module.app.openapi_url is None