gunicorn/tests/001-test-valid-requests.py
Paul J. Davis 5af1273fc2 Added more valid request tests.
Found and fixed a couple read and readline related bugs.
2010-06-03 16:11:18 -04:00

35 lines
923 B
Python

# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import t
import treq
import glob
import os
dirname = os.path.dirname(__file__)
reqdir = os.path.join(dirname, "requests", "valid")
def load_py(fname):
config = globals().copy()
config["uri"] = treq.uri
execfile(fname, config)
return config["request"]
def a_case(fname):
expect = load_py(os.path.splitext(fname)[0] + ".py")
req = treq.request(fname, expect)
for case in req.gen_cases():
case[0](*case[1:])
def test_http_parser():
for fname in glob.glob(os.path.join(reqdir, "*.http")):
if os.getenv("GUNS_BLAZING"):
expect = load_py(os.path.splitext(fname)[0] + ".py")
req = treq.request(fname, expect)
for case in req.gen_cases():
yield case
else:
yield (a_case, fname)