1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Migrate REST switch to async (#4517)

* Migrate REST switch to async

* Update rest.py

* Address comments from paulus
This commit is contained in:
Pascal Vizeli
2016-12-13 17:55:13 +01:00
committed by Paulus Schoutsen
parent 72bd9fb5c7
commit e4b6395250
3 changed files with 204 additions and 137 deletions

View File

@@ -20,6 +20,7 @@ class AiohttpClientMocker:
auth=None,
status=200,
text=None,
data=None,
content=None,
json=None,
params=None,
@@ -66,12 +67,12 @@ class AiohttpClientMocker:
return len(self.mock_calls)
@asyncio.coroutine
def match_request(self, method, url, *, auth=None, params=None,
def match_request(self, method, url, *, data=None, auth=None, params=None,
headers=None): # pylint: disable=unused-variable
"""Match a request against pre-registered requests."""
for response in self._mocks:
if response.match_request(method, url, params):
self.mock_calls.append((method, url))
self.mock_calls.append((method, url, data))
if self.exc:
raise self.exc