Exemple #1
0
def hassio_handler(hass, aioclient_mock):
    """Create mock hassio handler."""
    async def get_client_session():
        return hass.helpers.aiohttp_client.async_get_clientsession()

    websession = hass.loop.run_until_complete(get_client_session())

    with patch.dict(os.environ, {"HASSIO_TOKEN": HASSIO_TOKEN}):
        yield HassIO(hass.loop, websession, "127.0.0.1")
Exemple #2
0
def hassio_handler(hass, aioclient_mock):
    """Create mock hassio handler."""
    async def get_client_session():
        return async_get_clientsession(hass)

    websession = hass.loop.run_until_complete(get_client_session())

    with patch.dict(os.environ, {"SUPERVISOR_TOKEN": SUPERVISOR_TOKEN}):
        yield HassIO(hass.loop, websession, "127.0.0.1")
Exemple #3
0
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")