Files
operating-room-monitor-server/tests/test_baidu_unified_env.py

21 lines
614 B
Python
Raw Normal View History

"""百度凭据:仅从环境变量 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