@@ -244,9 +244,9 @@ def test_token_exchange1(self, token):
244244 Test that token exchange requests work correctly with only the required parameters
245245 present
246246 """
247- if list (token .keys ())[0 ] == "refresh_token" :
248- AUTH_REQ ["scope" ] = ["openid" , "offline_access" ]
249247 areq = AUTH_REQ .copy ()
248+ if list (token .keys ())[0 ] == "refresh_token" :
249+ areq ["scope" ] = ["openid" , "offline_access" ]
250250
251251 session_id = self ._create_session (areq )
252252 grant = self .endpoint_context .authz (session_id , areq )
@@ -288,9 +288,9 @@ def test_token_exchange2(self, token):
288288 """
289289 Test that token exchange requests work correctly
290290 """
291- if list (token .keys ())[0 ] == "refresh_token" :
292- AUTH_REQ ["scope" ] = ["openid" , "offline_access" ]
293291 areq = AUTH_REQ .copy ()
292+ if list (token .keys ())[0 ] == "refresh_token" :
293+ areq ["scope" ] = ["openid" , "offline_access" ]
294294
295295 session_id = self ._create_session (areq )
296296 grant = self .endpoint_context .authz (session_id , areq )
@@ -342,6 +342,7 @@ def test_token_exchange_per_client(self, token):
342342 "urn:ietf:params:oauth:token-type:access_token" ,
343343 "urn:ietf:params:oauth:token-type:refresh_token" ,
344344 ],
345+ "default_requested_token_type" : "urn:ietf:params:oauth:token-type:access_token" ,
345346 "policy" : {
346347 "" : {
347348 "callable" : "idpyoidc.server.oauth2.token_helper.validate_token_exchange_policy" ,
@@ -350,9 +351,10 @@ def test_token_exchange_per_client(self, token):
350351 },
351352 }
352353
353- if list (token .keys ())[0 ] == "refresh_token" :
354- AUTH_REQ ["scope" ] = ["openid" , "offline_access" ]
355354 areq = AUTH_REQ .copy ()
355+ if list (token .keys ())[0 ] == "refresh_token" :
356+ areq ["scope" ] = ["openid" , "offline_access" ]
357+
356358
357359 session_id = self ._create_session (areq )
358360 grant = self .endpoint_context .authz (session_id , areq )
@@ -509,8 +511,8 @@ def test_refresh_token_audience(self):
509511 """
510512 Test that requesting a refresh token with audience fails.
511513 """
512- AUTH_REQ ["scope" ] = ["openid" , "offline_access" ]
513514 areq = AUTH_REQ .copy ()
515+ areq ["scope" ] = ["openid" , "offline_access" ]
514516
515517 session_id = self ._create_session (areq )
516518 grant = self .endpoint_context .authz (session_id , areq )
@@ -579,8 +581,8 @@ def test_exchange_refresh_token_to_refresh_token(self):
579581 """
580582 Test whether exchanging a refresh token to another refresh token works.
581583 """
582- AUTH_REQ ["scope" ] = ["openid" , "offline_access" ]
583584 areq = AUTH_REQ .copy ()
585+ areq ["scope" ] = ["openid" , "offline_access" ]
584586
585587 session_id = self ._create_session (areq )
586588 grant = self .endpoint_context .authz (session_id , areq )
@@ -615,8 +617,8 @@ def test_exchange_refresh_token_to_refresh_token(self):
615617 ],
616618 )
617619 def test_exchange_access_token_to_refresh_token (self , scopes ):
618- AUTH_REQ ["scope" ] = scopes
619620 areq = AUTH_REQ .copy ()
621+ areq ["scope" ] = scopes
620622
621623 session_id = self ._create_session (areq )
622624 grant = self .endpoint_context .authz (session_id , areq )
0 commit comments