Skip to content

Commit

Permalink
test: also confirm str(exc) for invalid requests
Browse files Browse the repository at this point in the history
  • Loading branch information
pajod committed Jul 4, 2024
1 parent dd4495f commit 1289239
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tests/requests/invalid/version_03.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
GET /foo HTTP/0.9\r\n
\r\n
2 changes: 2 additions & 0 deletions tests/requests/invalid/version_03.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from gunicorn.http.errors import InvalidHTTPVersion
request = InvalidHTTPVersion
3 changes: 2 additions & 1 deletion tests/test_invalid_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ def test_http_parser(fname):
cfg = env["cfg"]
req = treq.badrequest(fname)

with pytest.raises(expect):
# telling pytest to match the exception string validates its __str__()
with pytest.raises(expect, match="."):
req.check(cfg)

0 comments on commit 1289239

Please sign in to comment.