Skip to content

Commit

Permalink
Add regression test for HTTPUnathorized per aio-libs#5657
Browse files Browse the repository at this point in the history
  • Loading branch information
paulefoe committed May 7, 2021
1 parent 4d58400 commit be250ec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES/5657.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added regression test for ``HTTPUnauthorized`` body param
12 changes: 12 additions & 0 deletions tests/test_web_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,3 +332,15 @@ def test_pickle(self) -> None:
assert resp2.reason == "Zaprescheno"
assert resp2.status == 451
assert resp2.foo == "bar"


@pytest.mark.xfail(
raises=(TypeError, AttributeError),
reason="Regression in v3.7: https://github.com/aio-libs/aiohttp/issues/5657",
)
def test_body_unauthorized() -> None:
resp = web.HTTPUnauthorized(
headers={"X-Custom": "value"}, content_type="custom", body="text"
)
assert resp.status == 401
assert resp.text == "text"

0 comments on commit be250ec

Please sign in to comment.