支持自定义端口

This commit is contained in:
2026-07-03 19:33:16 +08:00
parent 83b55c0c72
commit 8c05311628
7 changed files with 28 additions and 4 deletions
+13
View File
@@ -49,6 +49,7 @@ class FakeClient:
def client_and_provider(tmp_path: Path) -> tuple[TestClient, FakeClient]:
provider = FakeClient()
settings = Settings(
port=8000,
api_key=None,
base_url="https://api.deepseek.com",
model="deepseek-v4-flash",
@@ -66,6 +67,18 @@ def create_session(client: TestClient, **body: str) -> str:
return response.json()["session_id"]
def test_settings_load_api_key_from_dotenv(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
) -> None:
monkeypatch.chdir(tmp_path)
monkeypatch.delenv("DEEPSEEK_API_KEY", raising=False)
(tmp_path / ".env").write_text("DEEPSEEK_API_KEY=test-key\n")
settings = Settings.from_env()
assert settings.api_key == "test-key"
def test_create_session_uses_default_prompt(
client_and_provider: tuple[TestClient, FakeClient], tmp_path: Path
) -> None: