diff options
author | Andrei Zeliankou <zelenkov@nginx.com> | 2019-11-13 18:11:24 +0300 |
---|---|---|
committer | Andrei Zeliankou <zelenkov@nginx.com> | 2019-11-13 18:11:24 +0300 |
commit | 5452ee458d2c764569213266362fb636114adbc2 (patch) | |
tree | a3fa05f63f141b94e40a43e9c93061c4dd7afe70 /test/unit | |
parent | 45d75ee2cb33d38f64ca2ac5d871fa0cc2f1bcde (diff) | |
download | unit-5452ee458d2c764569213266362fb636114adbc2.tar.gz unit-5452ee458d2c764569213266362fb636114adbc2.tar.bz2 |
Tests: fixed websocket tests.
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/applications/websockets.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/test/unit/applications/websockets.py b/test/unit/applications/websockets.py index 5f78498c..ef16f433 100644 --- a/test/unit/applications/websockets.py +++ b/test/unit/applications/websockets.py @@ -31,17 +31,22 @@ class TestApplicationWebsocket(TestApplicationProto): sha1 = hashlib.sha1((key + GUID).encode()).digest() return base64.b64encode(sha1).decode() - def upgrade(self): - key = self.key() - _, sock = self.get( - headers={ + def upgrade(self, headers=None): + key = None + + if headers is None: + key = self.key() + headers = { 'Host': 'localhost', 'Upgrade': 'websocket', 'Connection': 'Upgrade', 'Sec-WebSocket-Key': key, 'Sec-WebSocket-Protocol': 'chat', 'Sec-WebSocket-Version': 13, - }, + } + + _, sock = self.get( + headers=headers, no_recv=True, start=True, ) |