pre-commit-ci-lite[bot]
6 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
3 additions and
0 deletions
-
tests/test_security_http_basic_default_realm.py
|
|
|
@ -5,12 +5,15 @@ from fastapi.testclient import TestClient |
|
|
|
app = FastAPI() |
|
|
|
security = HTTPBasic() |
|
|
|
|
|
|
|
|
|
|
|
@app.get("/users/me") |
|
|
|
def read_current_user(credentials: HTTPBasicCredentials = Depends(security)): |
|
|
|
return {"username": credentials.username, "password": credentials.password} |
|
|
|
|
|
|
|
|
|
|
|
client = TestClient(app) |
|
|
|
|
|
|
|
|
|
|
|
def test_security_http_basic_default_realm(): |
|
|
|
# 401 branch: should include default realm |
|
|
|
response = client.get("/users/me") |
|
|
|
|