diff --git a/tests/test_security_oauth2_authorization_code_bearer_scopes_openapi.py b/tests/test_security_oauth2_authorization_code_bearer_scopes_openapi.py index 583007c8b..b99e700e3 100644 --- a/tests/test_security_oauth2_authorization_code_bearer_scopes_openapi.py +++ b/tests/test_security_oauth2_authorization_code_bearer_scopes_openapi.py @@ -29,20 +29,20 @@ async def root(): @app.get( "/with-oauth2-scheme", - dependencies=[Security(oauth2_scheme, scopes=["read", "write"])], + dependencies=[Security(oauth2_scheme, oauth_scopes=["read", "write"])], ) async def read_with_oauth2_scheme(): return {"message": "Admin Access"} @app.get( - "/with-get-token", dependencies=[Security(get_token, scopes=["read", "write"])] + "/with-get-token", dependencies=[Security(get_token, oauth_scopes=["read", "write"])] ) async def read_with_get_token(): return {"message": "Admin Access"} -router = APIRouter(dependencies=[Security(oauth2_scheme, scopes=["read"])]) +router = APIRouter(dependencies=[Security(oauth2_scheme, oauth_scopes=["read"])]) @router.get("/items/") @@ -52,7 +52,7 @@ async def read_items(token: Optional[str] = Depends(oauth2_scheme)): @router.post("/items/") async def create_item( - token: Optional[str] = Security(oauth2_scheme, scopes=["read", "write"]), + token: Optional[str] = Security(oauth2_scheme, oauth_scopes=["read", "write"]), ): return {"token": token} diff --git a/tests/test_security_oauth2_authorization_code_bearer_scopes_openapi_simple.py b/tests/test_security_oauth2_authorization_code_bearer_scopes_openapi_simple.py index 1c21369d3..cf04eff58 100644 --- a/tests/test_security_oauth2_authorization_code_bearer_scopes_openapi_simple.py +++ b/tests/test_security_oauth2_authorization_code_bearer_scopes_openapi_simple.py @@ -21,7 +21,7 @@ async def get_token(token: Annotated[str, Depends(oauth2_scheme)]) -> str: app = FastAPI(dependencies=[Depends(get_token)]) -@app.get("/admin", dependencies=[Security(get_token, scopes=["read", "write"])]) +@app.get("/admin", dependencies=[Security(get_token, oauth_scopes=["read", "write"])]) async def read_admin(): return {"message": "Admin Access"}