Aiohttp 2.0

Ref #1000
This commit is contained in:
Julien Duponchelle committed 2017-05-17 18:42:17 +02:00
1 parent e9fef928b0
commit a4245fcf44
19 files changed
+72 -97

No files matched your search

@@ -129,19 +129,18 @@ def test_load_project(http_controller, project, config):
assert response.json["project_id"] == project.id
def test_notification(http_controller, project, controller, loop):
def test_notification(http_controller, project, controller, loop, async_run):
@asyncio.coroutine
def go(future):
response = yield from aiohttp.request("GET", http_controller.get_url("/projects/{project_id}/notifications".format(project_id=project.id)))
def go():
connector = aiohttp.TCPConnector()
response = yield from aiohttp.request("GET", http_controller.get_url("/projects/{project_id}/notifications".format(project_id=project.id)), connector=connector)
response.body = yield from response.content.read(200)
controller.notification.emit("node.created", {"a": "b"})
response.body += yield from response.content.read(50)
response.body += yield from response.content.readany()
response.close()
future.set_result(response)
return response
future = asyncio.Future()
asyncio.async(go(future))
response = loop.run_until_complete(future)
response = async_run(asyncio.async(go()))
assert response.status == 200
assert b'"action": "ping"' in response.body
assert b'"cpu_usage_percent"' in response.body
@@ -35,7 +35,6 @@ def test_symbols(http_controller):
def test_get(http_controller):
response = http_controller.get('/symbols/' + urllib.parse.quote(':/symbols/firewall.svg') + '/raw')
assert response.status == 200
assert response.headers['CONTENT-LENGTH'] == '9381'
assert response.headers['CONTENT-TYPE'] == 'image/svg+xml'
assert '</svg>' in response.html