Refactor homekit_controller config flow tests (#32141)
* Config flow test refactor * Add a service and characteristic to the accessory so its more realistic * Feedback from review * Missing apostrophe
This commit is contained in:
parent
ba4cc373c8
commit
c9d78aa78c
6 changed files with 296 additions and 634 deletions
|
@ -2,6 +2,8 @@
|
|||
import datetime
|
||||
from unittest import mock
|
||||
|
||||
from aiohomekit.testing import FakeController
|
||||
import asynctest
|
||||
import pytest
|
||||
|
||||
|
||||
|
@ -12,3 +14,11 @@ def utcnow(request):
|
|||
with mock.patch("homeassistant.util.dt.utcnow") as dt_utcnow:
|
||||
dt_utcnow.return_value = start_dt
|
||||
yield dt_utcnow
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def controller(hass):
|
||||
"""Replace aiohomekit.Controller with an instance of aiohomekit.testing.FakeController."""
|
||||
instance = FakeController()
|
||||
with asynctest.patch("aiohomekit.Controller", return_value=instance):
|
||||
yield instance
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue