1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Add event platform to Nice G.O. (#124253)

* Add event platform to Nice G.O.

* Add icon for barrier obstructed event

* Better assertions

* More test improvements
This commit is contained in:
IceBotYT
2024-08-19 16:09:22 -04:00
committed by GitHub
parent 566c00ef12
commit fc767ee562
5 changed files with 105 additions and 1 deletions

View File

@@ -0,0 +1,31 @@
"""Nice G.O. event tests."""
from unittest.mock import AsyncMock, MagicMock
import pytest
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from . import setup_integration
from tests.common import MockConfigEntry
@pytest.mark.freeze_time("2024-08-19")
async def test_barrier_obstructed(
hass: HomeAssistant,
mock_nice_go: AsyncMock,
mock_config_entry: MockConfigEntry,
) -> None:
"""Test barrier obstructed."""
mock_nice_go.event = MagicMock()
await setup_integration(hass, mock_config_entry, [Platform.EVENT])
await mock_nice_go.event.call_args_list[2][0][0]({"deviceId": "1"})
await hass.async_block_till_done()
event_state = hass.states.get("event.test_garage_1_barrier_obstructed")
assert event_state.state == "2024-08-19T00:00:00.000+00:00"
assert event_state.attributes["event_type"] == "barrier_obstructed"