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:
Jc2k authored and GitHub committed 2020-02-25 12:06:35 +01:00
1 parent ba4cc373c8
commit c9d78aa78c
6 files changed
+296 -634

No files matched your search

@@ -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