mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Parametrize invalid request tests.
This commit is contained in:
parent
72c8be56fc
commit
945d2ecfc3
@ -12,17 +12,15 @@ import pytest
|
|||||||
|
|
||||||
dirname = os.path.dirname(__file__)
|
dirname = os.path.dirname(__file__)
|
||||||
reqdir = os.path.join(dirname, "requests", "invalid")
|
reqdir = os.path.join(dirname, "requests", "invalid")
|
||||||
|
httpfiles = glob.glob(os.path.join(reqdir, "*.http"))
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("fname", httpfiles)
|
||||||
|
def test_http_parser(fname):
|
||||||
|
env = treq.load_py(os.path.splitext(fname)[0] + ".py")
|
||||||
|
|
||||||
def test_http_parser():
|
expect = env["request"]
|
||||||
for fname in glob.glob(os.path.join(reqdir, "*.http")):
|
cfg = env["cfg"]
|
||||||
env = treq.load_py(os.path.splitext(fname)[0] + ".py")
|
req = treq.badrequest(fname)
|
||||||
|
|
||||||
expect = env['request']
|
with pytest.raises(expect):
|
||||||
cfg = env['cfg']
|
req.check(cfg)
|
||||||
req = treq.badrequest(fname)
|
|
||||||
|
|
||||||
with pytest.raises(expect):
|
|
||||||
def f(fname):
|
|
||||||
return req.check(cfg)
|
|
||||||
f(fname)
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user