Add coverage for scanning tags with ESPHome (#107337)
This commit is contained in:
parent
1171a7a3d9
commit
3eb81bc461
1 changed files with 18 additions and 0 deletions
|
@ -87,6 +87,7 @@ async def test_esphome_device_service_calls_allowed(
|
|||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
"""Test a device with service calls are allowed."""
|
||||
await async_setup_component(hass, "tag", {})
|
||||
entity_info = []
|
||||
states = []
|
||||
user_service = []
|
||||
|
@ -202,6 +203,23 @@ async def test_esphome_device_service_calls_allowed(
|
|||
events.clear()
|
||||
caplog.clear()
|
||||
|
||||
# Try scanning a tag
|
||||
events = async_capture_events(hass, "tag_scanned")
|
||||
device.mock_service_call(
|
||||
HomeassistantServiceCall(
|
||||
service="esphome.tag_scanned",
|
||||
is_event=True,
|
||||
data={"tag_id": "1234"},
|
||||
)
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert len(events) == 1
|
||||
event = events[0]
|
||||
assert event.event_type == "tag_scanned"
|
||||
assert event.data["tag_id"] == "1234"
|
||||
events.clear()
|
||||
caplog.clear()
|
||||
|
||||
# Try firing events for disallowed domain
|
||||
events = async_capture_events(hass, "wrong.test")
|
||||
device.mock_service_call(
|
||||
|
|
Loading…
Add table
Reference in a new issue