Skip to content

Commit

Permalink
Add a test for numeric status code responses
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosuav committed Oct 7, 2023
1 parent 60a172e commit 9aa60ec
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/legacy/test_client_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,17 @@ def test_process_request_override(self):
with contextlib.closing(response):
self.assertEqual(response.code, 200)

class ProcessRequestOKServerProtocolNumeric(WebSocketServerProtocol):
async def process_request(self, path, request_headers):
return 200, [], b"OK\n"

@with_server(create_protocol=ProcessRequestOKServerProtocolNumeric)
def test_numeric_response_code(self):
response = self.loop.run_until_complete(self.make_http_request("/"))

with contextlib.closing(response):
self.assertEqual(response.code, 200)

class LegacyProcessRequestOKServerProtocol(WebSocketServerProtocol):
def process_request(self, path, request_headers):
return http.HTTPStatus.OK, [], b"OK\n"
Expand Down

0 comments on commit 9aa60ec

Please sign in to comment.