mirror of
https://github.com/sligter/LandPPT.git
synced 2026-08-30 17:34:51 +08:00
6153e56441
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>
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
import asyncio
|
|
from types import SimpleNamespace
|
|
|
|
|
|
def test_get_system_config_will_initialize_system_defaults(monkeypatch):
|
|
import landppt.api.config_api as config_api
|
|
|
|
calls = {
|
|
"initialized": False,
|
|
"get_all_config_called": False,
|
|
}
|
|
|
|
class FakeConfigService:
|
|
async def initialize_system_defaults(self):
|
|
calls["initialized"] = True
|
|
return 3
|
|
|
|
async def get_all_config(self, user_id=None):
|
|
calls["get_all_config_called"] = True
|
|
assert calls["initialized"] is True
|
|
assert user_id is None
|
|
return {
|
|
"default_ai_provider": "landppt",
|
|
"landppt_model": "MODEL1",
|
|
}
|
|
|
|
monkeypatch.setattr(config_api, "get_db_config_service", lambda: FakeConfigService(), raising=True)
|
|
|
|
result = asyncio.run(config_api.get_system_config(user=SimpleNamespace(is_admin=True)))
|
|
|
|
assert calls["initialized"] is True
|
|
assert calls["get_all_config_called"] is True
|
|
assert result["success"] is True
|
|
assert result["config"]["default_ai_provider"] == "landppt"
|
|
assert result["config"]["landppt_model"] == "MODEL1"
|