Tests: reworked python tests with application.
This commit is contained in:
4
test/python/204_no_content/wsgi.py
Normal file
4
test/python/204_no_content/wsgi.py
Normal file
@@ -0,0 +1,4 @@
|
||||
def application(environ, start_response):
|
||||
|
||||
start_response('204 No Content', [])
|
||||
return []
|
||||
12
test/python/atexit/wsgi.py
Normal file
12
test/python/atexit/wsgi.py
Normal file
@@ -0,0 +1,12 @@
|
||||
import atexit
|
||||
|
||||
def application(environ, start_response):
|
||||
test_dir = environ.get('HTTP_TEST_DIR')
|
||||
|
||||
def create_file():
|
||||
open(test_dir + '/atexit', 'w')
|
||||
|
||||
atexit.register(create_file)
|
||||
|
||||
start_response('200', [('Content-Length', '0')])
|
||||
return []
|
||||
3
test/python/empty/wsgi.py
Normal file
3
test/python/empty/wsgi.py
Normal file
@@ -0,0 +1,3 @@
|
||||
def application(env, start_response):
|
||||
start_response('200', [('Content-Length', '0')])
|
||||
return []
|
||||
10
test/python/mirror/wsgi.py
Normal file
10
test/python/mirror/wsgi.py
Normal file
@@ -0,0 +1,10 @@
|
||||
def application(environ, start_response):
|
||||
|
||||
content_length = int(environ.get('CONTENT_LENGTH', 0))
|
||||
body = bytes(environ['wsgi.input'].read(content_length))
|
||||
|
||||
start_response('200', [
|
||||
('Content-Type', environ.get('CONTENT_TYPE')),
|
||||
('Content-Length', str(len(body)))
|
||||
])
|
||||
return [body]
|
||||
7
test/python/query_string/wsgi.py
Normal file
7
test/python/query_string/wsgi.py
Normal file
@@ -0,0 +1,7 @@
|
||||
def application(environ, start_response):
|
||||
|
||||
start_response('200', [
|
||||
('Content-Length', '0'),
|
||||
('Query-String', environ.get('QUERY_STRING'))
|
||||
])
|
||||
return []
|
||||
7
test/python/server_port/wsgi.py
Normal file
7
test/python/server_port/wsgi.py
Normal file
@@ -0,0 +1,7 @@
|
||||
def application(environ, start_response):
|
||||
|
||||
start_response('200', [
|
||||
('Content-Length', '0'),
|
||||
('Server-Port', environ.get('SERVER_PORT'))
|
||||
])
|
||||
return []
|
||||
15
test/python/variables/wsgi.py
Normal file
15
test/python/variables/wsgi.py
Normal file
@@ -0,0 +1,15 @@
|
||||
def application(environ, start_response):
|
||||
|
||||
content_length = int(environ.get('CONTENT_LENGTH', 0))
|
||||
body = bytes(environ['wsgi.input'].read(content_length))
|
||||
|
||||
start_response('200', [
|
||||
('Content-Type', environ.get('CONTENT_TYPE')),
|
||||
('Content-Length', str(len(body))),
|
||||
('Request-Method', environ.get('REQUEST_METHOD')),
|
||||
('Request-Uri', environ.get('REQUEST_URI')),
|
||||
('Http-Host', environ.get('HTTP_HOST')),
|
||||
('Server-Protocol', environ.get('SERVER_PROTOCOL')),
|
||||
('Custom-Header', environ.get('HTTP_CUSTOM_HEADER'))
|
||||
])
|
||||
return [body]
|
||||
Reference in New Issue
Block a user