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 Apr 26, 2024
1 parent 90170c8 commit cc0adf4
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
@@ -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
@@ -0,0 +1,2 @@
from gunicorn.http.errors import InvalidHTTPVersion
request = InvalidHTTPVersion
3 changes: 2 additions & 1 deletion tests/test_invalid_requests.py
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 cc0adf4

Please sign in to comment.