mirror of
https://github.com/home-assistant/core.git
synced 2025-04-30 12:17:52 +00:00

* WIP * Add VoIP entities to enable calls * Mark voip entities as config only * Remove commented code
41 lines
1.1 KiB
Python
41 lines
1.1 KiB
Python
"""Test VoIP switch devices."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
|
|
async def test_allow_call(
|
|
hass: HomeAssistant, config_entry, voip_devices, call_info
|
|
) -> None:
|
|
"""Test allow call."""
|
|
assert not voip_devices.async_allow_call(call_info)
|
|
await hass.async_block_till_done()
|
|
|
|
state = hass.states.get("switch.192_168_1_210_allow_calls")
|
|
assert state is not None
|
|
assert state.state == "off"
|
|
|
|
await hass.config_entries.async_reload(config_entry.entry_id)
|
|
|
|
state = hass.states.get("switch.192_168_1_210_allow_calls")
|
|
assert state.state == "off"
|
|
|
|
await hass.services.async_call(
|
|
"switch",
|
|
"turn_on",
|
|
{"entity_id": "switch.192_168_1_210_allow_calls"},
|
|
blocking=True,
|
|
)
|
|
|
|
assert voip_devices.async_allow_call(call_info)
|
|
|
|
state = hass.states.get("switch.192_168_1_210_allow_calls")
|
|
assert state.state == "on"
|
|
|
|
await hass.config_entries.async_reload(config_entry.entry_id)
|
|
|
|
state = hass.states.get("switch.192_168_1_210_allow_calls")
|
|
assert state is not None
|
|
assert state.state == "on"
|