Refactor Hue: phue -> aiohue (#13043)

* phue -> aiohue

* Clean up

* Fix config

* Address comments

* Typo

* Fix rebase error

* Mark light as unavailable when bridge is disconnected

* Tests

* Make Throttle work with double delay and async

* Rework update logic

* Don't resolve host to IP

* Clarify comment

* No longer do unnecessary updates

* Add more doc

* Another comment update

* Wrap up tests

* Lint

* Fix tests

* PyLint does not like mix 'n match async and coroutine

* Lint

* Update aiohue to 1.2

* Lint

* Fix await MagicMock
This commit is contained in:
Paulus Schoutsen 2018-03-16 20:27:05 -07:00 committed by GitHub
parent d78e75db66
commit 5a9013cda5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 1289 additions and 1485 deletions

View file

@ -1,5 +1,4 @@
"""Test discovery helpers."""
import asyncio
from unittest.mock import patch
import pytest
@ -24,7 +23,8 @@ class TestHelpersDiscovery:
"""Stop everything that was started."""
self.hass.stop()
@patch('homeassistant.setup.async_setup_component')
@patch('homeassistant.setup.async_setup_component',
return_value=mock_coro())
def test_listen(self, mock_setup_component):
"""Test discovery listen/discover combo."""
helpers = self.hass.helpers
@ -199,15 +199,13 @@ class TestHelpersDiscovery:
assert len(component_calls) == 1
@asyncio.coroutine
def test_load_platform_forbids_config():
async def test_load_platform_forbids_config():
"""Test you cannot setup config component with load_platform."""
with pytest.raises(HomeAssistantError):
yield from discovery.async_load_platform(None, 'config', 'zwave')
await discovery.async_load_platform(None, 'config', 'zwave')
@asyncio.coroutine
def test_discover_forbids_config():
async def test_discover_forbids_config():
"""Test you cannot setup config component with load_platform."""
with pytest.raises(HomeAssistantError):
yield from discovery.async_discover(None, None, None, 'config')
await discovery.async_discover(None, None, None, 'config')