fix: better differentiation between UNAUTHORIZED and FORBIDDEN (#3139)

This commit is contained in:
Vlad Stan 2025-05-05 11:55:58 +03:00 committed by GitHub
parent 6a9089fd98
commit 3529f9152f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 39 additions and 45 deletions

View file

@ -76,7 +76,7 @@ async def test_check_user_exists_with_user_not_allowed(user_alan: User):
settings.lnbits_allowed_users = ["only_this_user_id"]
with pytest.raises(HTTPException) as exc_info:
await check_user_exists(request, access_token=None, usr=UUID4(user_alan.id))
assert exc_info.value.status_code == 401
assert exc_info.value.status_code == 403
assert exc_info.value.detail == "User not allowed."