将后端迁入 backend/,完善根目录 .gitignore,删除误提交的 .mypy_cache 缓存文件。 Co-authored-by: Cursor <cursoragent@cursor.com>
21 lines
614 B
Python
21 lines
614 B
Python
"""百度凭据:仅从环境变量 BAIDU_APP_ID / BAIDU_API_KEY / BAIDU_SECRET_KEY 读入。"""
|
|
|
|
import os
|
|
from unittest.mock import patch
|
|
|
|
from app.config import Settings
|
|
|
|
|
|
def test_speech_creds_from_baidu_env_triplet() -> None:
|
|
extra = {
|
|
"BAIDU_APP_ID": "app-x",
|
|
"BAIDU_API_KEY": "key-x",
|
|
"BAIDU_SECRET_KEY": "sec-x",
|
|
}
|
|
with patch.dict(os.environ, extra, clear=False):
|
|
s = Settings()
|
|
assert s.baidu_speech_app_id == "app-x"
|
|
assert s.baidu_speech_api_key == "key-x"
|
|
assert s.baidu_speech_secret_key == "sec-x"
|
|
assert s.baidu_speech_configured is True
|