Fix conflicting test case name

... and fix the wrong format of Sec-WebSocket-Protocol header in test
case.
This commit is contained in:
Takashi Kajinami 2025-06-08 22:15:27 +09:00
parent 9ffe1493da
commit e92a6ddf42
1 changed files with 4 additions and 4 deletions

View File

@ -81,7 +81,7 @@ class AcceptTestCase(unittest.TestCase):
ws.accept(sock, {'upgrade': 'websocket', ws.accept(sock, {'upgrade': 'websocket',
'Sec-WebSocket-Version': '13', 'Sec-WebSocket-Version': '13',
'Sec-WebSocket-Key': 'DKURYVK9cRFul1vOZVA56Q==', 'Sec-WebSocket-Key': 'DKURYVK9cRFul1vOZVA56Q==',
'Sec-WebSocket-Protocol': 'foobar gazonk'}) 'Sec-WebSocket-Protocol': 'foobar,gazonk'})
self.assertEqual(sock.data[:13], b'HTTP/1.1 101 ') self.assertEqual(sock.data[:13], b'HTTP/1.1 101 ')
self.assertTrue(b'\r\nSec-WebSocket-Protocol: gazonk\r\n' in sock.data) self.assertTrue(b'\r\nSec-WebSocket-Protocol: gazonk\r\n' in sock.data)
@ -101,9 +101,9 @@ class AcceptTestCase(unittest.TestCase):
sock, {'upgrade': 'websocket', sock, {'upgrade': 'websocket',
'Sec-WebSocket-Version': '13', 'Sec-WebSocket-Version': '13',
'Sec-WebSocket-Key': 'DKURYVK9cRFul1vOZVA56Q==', 'Sec-WebSocket-Key': 'DKURYVK9cRFul1vOZVA56Q==',
'Sec-WebSocket-Protocol': 'foobar gazonk'}) 'Sec-WebSocket-Protocol': 'foobar,gazonk'})
def test_protocol(self): def test_unsupported_protocol(self):
class ProtoSocket(websocket.WebSocket): class ProtoSocket(websocket.WebSocket):
def select_subprotocol(self, protocol): def select_subprotocol(self, protocol):
return 'oddball' return 'oddball'
@ -114,7 +114,7 @@ class AcceptTestCase(unittest.TestCase):
sock, {'upgrade': 'websocket', sock, {'upgrade': 'websocket',
'Sec-WebSocket-Version': '13', 'Sec-WebSocket-Version': '13',
'Sec-WebSocket-Key': 'DKURYVK9cRFul1vOZVA56Q==', 'Sec-WebSocket-Key': 'DKURYVK9cRFul1vOZVA56Q==',
'Sec-WebSocket-Protocol': 'foobar gazonk'}) 'Sec-WebSocket-Protocol': 'foobar,gazonk'})
class PingPongTest(unittest.TestCase): class PingPongTest(unittest.TestCase):
def setUp(self): def setUp(self):