Hassio cleanup part2 (#12588)

* Update handler.py

* Update handler.py

* Update __init__.py

* Update handler.py

* Update handler.py

* Update __init__.py

* Update tests
This commit is contained in:
Pascal Vizeli 2018-02-21 22:42:55 +01:00 committed by GitHub
parent 51c06e35cf
commit b228695907
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 260 additions and 129 deletions

View file

@ -5,9 +5,10 @@ from unittest.mock import patch, Mock
import pytest
from homeassistant.setup import async_setup_component
from homeassistant.components.hassio.handler import HassIO
from tests.common import mock_coro
from . import API_PASSWORD
from . import API_PASSWORD, HASSIO_TOKEN
@pytest.fixture
@ -38,3 +39,12 @@ def hassio_client(hassio_env, hass, test_client):
}
}))
yield hass.loop.run_until_complete(test_client(hass.http.app))
@pytest.fixture
def hassio_handler(hass, aioclient_mock):
"""Create mock hassio handler."""
websession = hass.helpers.aiohttp_client.async_get_clientsession()
with patch.dict(os.environ, {'HASSIO_TOKEN': HASSIO_TOKEN}):
yield HassIO(hass.loop, websession, "127.0.0.1")