mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Parametrize valid request tests.
This commit is contained in:
parent
882e00f6b5
commit
2af9468940
@ -3,30 +3,25 @@
|
|||||||
# This file is part of gunicorn released under the MIT license.
|
# This file is part of gunicorn released under the MIT license.
|
||||||
# See the NOTICE for more information.
|
# See the NOTICE for more information.
|
||||||
|
|
||||||
import treq
|
|
||||||
|
|
||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
import treq
|
||||||
|
|
||||||
dirname = os.path.dirname(__file__)
|
dirname = os.path.dirname(__file__)
|
||||||
|
|
||||||
reqdir = os.path.join(dirname, "requests", "valid")
|
reqdir = os.path.join(dirname, "requests", "valid")
|
||||||
|
httpfiles = glob.glob(os.path.join(reqdir, "*.http"))
|
||||||
|
|
||||||
def a_case(fname):
|
|
||||||
|
@pytest.mark.parametrize("fname", httpfiles)
|
||||||
|
def test_http_parser(fname):
|
||||||
env = treq.load_py(os.path.splitext(fname)[0] + ".py")
|
env = treq.load_py(os.path.splitext(fname)[0] + ".py")
|
||||||
|
|
||||||
expect = env['request']
|
expect = env['request']
|
||||||
cfg = env['cfg']
|
cfg = env['cfg']
|
||||||
req = treq.request(fname, expect)
|
req = treq.request(fname, expect)
|
||||||
|
|
||||||
for case in req.gen_cases(cfg):
|
for case in req.gen_cases(cfg):
|
||||||
case[0](*case[1:])
|
case[0](*case[1:])
|
||||||
|
|
||||||
def test_http_parser():
|
|
||||||
for fname in glob.glob(os.path.join(reqdir, "*.http")):
|
|
||||||
if os.getenv("GUNS_BLAZING"):
|
|
||||||
env = treq.load_py(os.path.splitext(fname)[0] + ".py")
|
|
||||||
expect = env['request']
|
|
||||||
cfg = env['cfg']
|
|
||||||
req = treq.request(fname, expect)
|
|
||||||
for case in req.gen_cases(cfg):
|
|
||||||
yield case
|
|
||||||
else:
|
|
||||||
yield (a_case, fname)
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user