Move HomeAssistantView to separate file. Convert http to async syntax. [skip ci] (#12982)

* Move HomeAssistantView to separate file. Convert http to async syntax.

* pylint

* websocket api

* update emulated_hue for async/await

* Lint
This commit is contained in:
Boyi C authored and Paulus Schoutsen committed 2018-03-08 17:51:49 -08:00
1 parent 2ee73ca911
commit 321eb2ec6f
17 files changed
+292 -344

No files matched your search

+3 -6
View File
@@ -1,5 +1,4 @@
"""Tests for the HTTP component."""
import asyncio
from ipaddress import ip_address
from aiohttp import web
@@ -18,18 +17,16 @@ def mock_real_ip(app):
nonlocal ip_to_mock
ip_to_mock = value
@asyncio.coroutine
@web.middleware
def mock_real_ip(request, handler):
async def mock_real_ip(request, handler):
"""Mock Real IP middleware."""
nonlocal ip_to_mock
request[KEY_REAL_IP] = ip_address(ip_to_mock)
return (yield from handler(request))
return (await handler(request))
@asyncio.coroutine
def real_ip_startup(app):
async def real_ip_startup(app):
"""Startup of real ip."""
app.middlewares.insert(0, mock_real_ip)