提交 dc6705ce 编写于 作者: M Michael Boulton

Fix websocket test bugs

上级 7f2837e5
...@@ -61,7 +61,7 @@ class TestInvalidWebsocketResponse(object): ...@@ -61,7 +61,7 @@ class TestInvalidWebsocketResponse(object):
transport="websockets" transport="websockets"
) )
with fake_websocket_broker.serve("200 OK\n"): with fake_websocket_broker.serve("200 OK\n".encode("utf8")):
with pytest.raises(WebsocketConnectionError) as exc: with pytest.raises(WebsocketConnectionError) as exc:
mqttc.connect("localhost", 1888, keepalive=10) mqttc.connect("localhost", 1888, keepalive=10)
...@@ -209,7 +209,10 @@ class TestValidHeaders(object): ...@@ -209,7 +209,10 @@ class TestValidHeaders(object):
# Make sure it connects to the right path # Make sure it connects to the right path
assert re.search("GET {:s} HTTP/1.1".format(mqtt_path), decoded, re.IGNORECASE) is not None assert re.search("GET {:s} HTTP/1.1".format(mqtt_path), decoded, re.IGNORECASE) is not None
response = self._get_callback_handler(init_response_headers) response = self._get_callback_handler(
init_response_headers,
check_request=create_response_hash,
)
with fake_websocket_broker.serve(response): with fake_websocket_broker.serve(response):
mqttc.connect("localhost", 1888, keepalive=10) mqttc.connect("localhost", 1888, keepalive=10)
...@@ -241,7 +244,10 @@ class TestValidHeaders(object): ...@@ -241,7 +244,10 @@ class TestValidHeaders(object):
for h in auth_headers: for h in auth_headers:
assert re.search("{:s}: {:s}".format(h, auth_headers[h]), decoded, re.IGNORECASE) is not None assert re.search("{:s}: {:s}".format(h, auth_headers[h]), decoded, re.IGNORECASE) is not None
response = self._get_callback_handler(init_response_headers) response = self._get_callback_handler(
init_response_headers,
check_request=create_response_hash,
)
with fake_websocket_broker.serve(response): with fake_websocket_broker.serve(response):
mqttc.connect("localhost", 1888, keepalive=10) mqttc.connect("localhost", 1888, keepalive=10)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册