generated from jCloud/repository-template
Bug fix: HTTPException should not be used in a middleware, so use JSONResponse instead
This commit is contained in:
+4
-2
@@ -104,6 +104,8 @@ async def test_GiteaSignatureMiddleware_valid_signature(body, secret):
|
||||
res = await middleware.dispatch(req, call_next)
|
||||
assert hasattr(res, 'called')
|
||||
|
||||
import pprint
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize('signature,body,secret', [
|
||||
(make_signature(b'body', b''), b'body', b'\x42'),
|
||||
@@ -139,5 +141,5 @@ async def test_GiteaSignatureMiddleware_invalid_signature(signature, body, secre
|
||||
headers
|
||||
)
|
||||
|
||||
with pytest.raises(HTTPException):
|
||||
await middleware.dispatch(req, call_next)
|
||||
res = await middleware.dispatch(req, call_next)
|
||||
assert res.status_code == 401
|
||||
Reference in New Issue
Block a user