From 58b2ee152d157d3bac8463de3c56ce2ab8812849 Mon Sep 17 00:00:00 2001 From: grossmj Date: Fri, 30 Nov 2018 18:59:02 +0800 Subject: [PATCH] Fix Docker console test. --- gns3server/compute/docker/docker_vm.py | 2 +- tests/compute/docker/test_docker_vm.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gns3server/compute/docker/docker_vm.py b/gns3server/compute/docker/docker_vm.py index 216a5889..dd4f6de7 100644 --- a/gns3server/compute/docker/docker_vm.py +++ b/gns3server/compute/docker/docker_vm.py @@ -671,7 +671,7 @@ class DockerVM(BaseNode): while True: msg = await ws.receive() - if msg.type == aiohttp.WSMsgType.text: + if msg.type == aiohttp.WSMsgType.TEXT: out.feed_data(msg.data.encode()) elif msg.type == aiohttp.WSMsgType.BINARY: out.feed_data(msg.data) diff --git a/tests/compute/docker/test_docker_vm.py b/tests/compute/docker/test_docker_vm.py index 3740594f..bf484390 100644 --- a/tests/compute/docker/test_docker_vm.py +++ b/tests/compute/docker/test_docker_vm.py @@ -1037,11 +1037,11 @@ def test_read_console_output_with_binary_mode(vm, loop): async def receive(self): if not self.sent: self.sent = True - return MagicMock(tp=aiohttp.WSMsgType.BINARY, data=b"test") + return MagicMock(type=aiohttp.WSMsgType.BINARY, data=b"test") else: - return MagicMock(tp=aiohttp.WSMsgType.CLOSE) + return MagicMock(type=aiohttp.WSMsgType.CLOSE) - def close(self): + async def close(self): pass input_stream = InputStreamMock()