mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-04 22:41:12 +02:00
Code cleanup
This commit is contained in:
5 files changed
+34
-35
No files matched your search
@@ -61,20 +61,20 @@ class Query:
|
||||
body = json.dumps(body)
|
||||
|
||||
@asyncio.coroutine
|
||||
def go(future):
|
||||
def go_request(future):
|
||||
response = yield from aiohttp.request(method, self.get_url(path, api_version), data=body)
|
||||
future.set_result(response)
|
||||
future = asyncio.Future()
|
||||
asyncio.async(go(future))
|
||||
asyncio.async(go_request(future))
|
||||
self._loop.run_until_complete(future)
|
||||
response = future.result()
|
||||
|
||||
@asyncio.coroutine
|
||||
def go(future, response):
|
||||
def go_read(future, response):
|
||||
response = yield from response.read()
|
||||
future.set_result(response)
|
||||
future = asyncio.Future()
|
||||
asyncio.async(go(future, response))
|
||||
asyncio.async(go_read(future, response))
|
||||
self._loop.run_until_complete(future)
|
||||
response.body = future.result()
|
||||
x_route = response.headers.get('X-Route', None)
|
||||
|
||||
@@ -42,7 +42,7 @@ def test_reserve_tcp_port_outside_range():
|
||||
assert mock_emit.call_args[0][0] == "log.warning"
|
||||
|
||||
|
||||
def test_reserve_tcp_port_already_used():
|
||||
def test_reserve_tcp_port_already_used_by_another_program():
|
||||
"""
|
||||
This test simulate a scenario where the port is already taken
|
||||
by another programm on the server
|
||||
@@ -65,6 +65,7 @@ def test_reserve_tcp_port_already_used():
|
||||
assert port != 2001
|
||||
assert mock_emit.call_args[0][0] == "log.warning"
|
||||
|
||||
|
||||
def test_reserve_tcp_port_already_used():
|
||||
"""
|
||||
This test simulate a scenario where the port is already taken
|
||||
|
||||
Reference in new issue
Block a user