def test_body_response(self) -> None: e = HttpRequestRejected( status_code=httpStatusCodes.NOT_FOUND, reason=b'NOT FOUND', body=b'Nothing here') self.assertEqual( e.response(self.request), build_http_response(httpStatusCodes.NOT_FOUND, reason=b'NOT FOUND', body=b'Nothing here'))
def test_status_code_response(self) -> None: e = HttpRequestRejected(status_code=200, reason=b'OK') self.assertEqual( e.response(self.request), CRLF.join([ b'HTTP/1.1 200 OK', b'Connection: close', CRLF, ]), )
def test_empty_response(self) -> None: e = HttpRequestRejected() self.assertEqual(e.response(self.request), None)