Add homekit_controller tests (#20457)
* Add a test for a homekit_controller switch * Add a test for a homekit_controller lightbulb * Add a test for homekit_controller thermostat * Changes from review * Patch utcnow to known time in HK tests * Neater fixture use per review
This commit is contained in:
parent
7368c623d4
commit
10e3698fd7
9 changed files with 343 additions and 5 deletions
14
tests/components/homekit_controller/conftest.py
Normal file
14
tests/components/homekit_controller/conftest.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
"""HomeKit controller session fixtures."""
|
||||
import datetime
|
||||
from unittest import mock
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def utcnow(request):
|
||||
"""Freeze time at a known point."""
|
||||
start_dt = datetime.datetime(2019, 1, 1, 0, 0, 0)
|
||||
with mock.patch('homeassistant.util.dt.utcnow') as dt_utcnow:
|
||||
dt_utcnow.return_value = start_dt
|
||||
yield dt_utcnow
|
Loading…
Add table
Add a link
Reference in a new issue