/opt/imh-python/lib/python3.9/site-packages/cheroot/test
NameSizeModeActions
__pycache__/-0755rm
conftest.py27150644editdlrm
helper.py47550644editdlrm
test_cli.py26640644editdlrm
test_conn.py533930644editdlrm
test_core.py146990644editdlrm
test_dispatch.py12100644editdlrm
test_errors.py9240644editdlrm
test_makefile.py11910644editdlrm
test_server.py166970644editdlrm
test_ssl.py222680644editdlrm
test_wsgi.py28230644editdlrm
test__compat.py16610644editdlrm
webtest.py183980644editdlrm
_pytest_plugin.py17680644editdlrm
__init__.py260644editdlrm
Edit: /opt/imh-python/lib/python3.9/site-packages/cheroot/test/test_dispatch.py (1210B)
"""Tests for the HTTP server.""" from cheroot.wsgi import PathInfoDispatcher def wsgi_invoke(app, environ): """Serve 1 request from a WSGI application.""" response = {} def start_response(status, headers): response.update({ 'status': status, 'headers': headers, }) response['body'] = b''.join( app(environ, start_response), ) return response def test_dispatch_no_script_name(): """Dispatch despite lack of ``SCRIPT_NAME`` in environ.""" # Bare bones WSGI hello world app (from PEP 333). def app(environ, start_response): start_response( '200 OK', [ ('Content-Type', 'text/plain; charset=utf-8'), ], ) return [u'Hello, world!'.encode('utf-8')] # Build a dispatch table. d = PathInfoDispatcher([ ('/', app), ]) # Dispatch a request without `SCRIPT_NAME`. response = wsgi_invoke( d, { 'PATH_INFO': '/foo', }, ) assert response == { 'status': '200 OK', 'headers': [ ('Content-Type', 'text/plain; charset=utf-8'), ], 'body': b'Hello, world!', }