pre-commit-ci-lite[bot]
4 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
6 additions and
2 deletions
-
tests/test_security_oauth2_lazy_initialization.py
|
|
|
@ -9,7 +9,9 @@ auth_code_router = APIRouter() |
|
|
|
|
|
|
|
|
|
|
|
@auth_code_router.get("/private-route") |
|
|
|
async def private_route(token: str | None = Security(auth_code_scheme, scopes=["admin"])): |
|
|
|
async def private_route( |
|
|
|
token: str | None = Security(auth_code_scheme, scopes=["admin"]), |
|
|
|
): |
|
|
|
return {"token": token} |
|
|
|
|
|
|
|
|
|
|
|
@ -39,7 +41,9 @@ def test_oauth2_authorization_code_bearer_lazy_initialize(): |
|
|
|
authorization_code_flow = openapi.json()["components"]["securitySchemes"][ |
|
|
|
"OAuth2AuthorizationCodeBearer" |
|
|
|
]["flows"]["authorizationCode"] |
|
|
|
assert authorization_code_flow["authorizationUrl"] == "https://example.com/authorize" |
|
|
|
assert ( |
|
|
|
authorization_code_flow["authorizationUrl"] == "https://example.com/authorize" |
|
|
|
) |
|
|
|
assert authorization_code_flow["tokenUrl"] == "https://example.com/oauth/token" |
|
|
|
assert authorization_code_flow["scopes"] == {"admin": "Admin access"} |
|
|
|
|
|
|
|
|