mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 10:59:40 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user