39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
from hass.typing import AppConfig
|
|||
|
|
|
||
|
|
|
||
|
|
def test_xiaoai_config_defaults():
|
||
|
|
cfg = AppConfig.model_validate(
|
||
|
|
{
|
||
|
|
"homeassistant": {
|
||
|
|
"url": "http://ha.local:8123",
|
||
|
|
"access_token": "token",
|
||
|
|
}
|
||
|
|
}
|
||
|
|
)
|
||
|
|
|
||
|
|
assert cfg.xiaoai.continuous_conversation_enabled is True
|
||
|
|
assert cfg.xiaoai.session_idle_timeout_seconds == 15
|
||
|
|
assert cfg.xiaoai.session_end_keywords == ["再见", "拜拜", "滚", "退下"]
|
||
|
|
assert cfg.xiaoai.client_ip_area_mapping == {}
|
||
|
|
assert cfg.xiaoai.interrupt_on_new_input is True
|
||
|
|
|
||
|
|
|
||
|
|
def test_xiaoai_config_area_mapping_loaded():
|
||
|
|
cfg = AppConfig.model_validate(
|
||
|
|
{
|
||
|
|
"homeassistant": {
|
||
|
|
"url": "http://ha.local:8123",
|
||
|
|
"access_token": "token",
|
||
|
|
},
|
||
|
|
"xiaoai": {
|
||
|
|
"client_ip_area_mapping": {
|
||
|
|
"192.168.1.10": "客厅",
|
||
|
|
"192.168.1.11": "书房",
|
||
|
|
}
|
||
|
|
},
|
||
|
|
}
|
||
|
|
)
|
||
|
|
|
||
|
|
assert cfg.xiaoai.client_ip_area_mapping["192.168.1.10"] == "客厅"
|
||
|
|
assert cfg.xiaoai.client_ip_area_mapping["192.168.1.11"] == "书房"
|