支持自定义端口
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user