@@ -91,7 +91,7 @@ def oauth_client_info():
9191def oauth_token ():
9292 return OAuthToken (
9393 access_token = "test_access_token" ,
94- token_type = "bearer " ,
94+ token_type = "Bearer " ,
9595 expires_in = 3600 ,
9696 refresh_token = "test_refresh_token" ,
9797 scope = "read write" ,
@@ -143,7 +143,8 @@ def test_generate_code_verifier(self, oauth_provider):
143143 verifiers = {oauth_provider ._generate_code_verifier () for _ in range (10 )}
144144 assert len (verifiers ) == 10
145145
146- def test_generate_code_challenge (self , oauth_provider ):
146+ @pytest .mark .anyio
147+ async def test_generate_code_challenge (self , oauth_provider ):
147148 """Test PKCE code challenge generation."""
148149 verifier = "test_code_verifier_123"
149150 challenge = oauth_provider ._generate_code_challenge (verifier )
@@ -161,7 +162,8 @@ def test_generate_code_challenge(self, oauth_provider):
161162 assert "+" not in challenge
162163 assert "/" not in challenge
163164
164- def test_get_authorization_base_url (self , oauth_provider ):
165+ @pytest .mark .anyio
166+ async def test_get_authorization_base_url (self , oauth_provider ):
165167 """Test authorization base URL extraction."""
166168 # Test with path
167169 assert (
@@ -348,11 +350,13 @@ async def test_register_oauth_client_failure(self, oauth_provider):
348350 None ,
349351 )
350352
351- def test_has_valid_token_no_token (self , oauth_provider ):
353+ @pytest .mark .anyio
354+ async def test_has_valid_token_no_token (self , oauth_provider ):
352355 """Test token validation with no token."""
353356 assert not oauth_provider ._has_valid_token ()
354357
355- def test_has_valid_token_valid (self , oauth_provider , oauth_token ):
358+ @pytest .mark .anyio
359+ async def test_has_valid_token_valid (self , oauth_provider , oauth_token ):
356360 """Test token validation with valid token."""
357361 oauth_provider ._current_tokens = oauth_token
358362 oauth_provider ._token_expiry_time = time .time () + 3600 # Future expiry
@@ -370,7 +374,7 @@ async def test_has_valid_token_expired(self, oauth_provider, oauth_token):
370374 @pytest .mark .anyio
371375 async def test_validate_token_scopes_no_scope (self , oauth_provider ):
372376 """Test scope validation with no scope returned."""
373- token = OAuthToken (access_token = "test" , token_type = "bearer " )
377+ token = OAuthToken (access_token = "test" , token_type = "Bearer " )
374378
375379 # Should not raise exception
376380 await oauth_provider ._validate_token_scopes (token )
@@ -381,7 +385,7 @@ async def test_validate_token_scopes_valid(self, oauth_provider, client_metadata
381385 oauth_provider .client_metadata = client_metadata
382386 token = OAuthToken (
383387 access_token = "test" ,
384- token_type = "bearer " ,
388+ token_type = "Bearer " ,
385389 scope = "read write" ,
386390 )
387391
@@ -394,7 +398,7 @@ async def test_validate_token_scopes_subset(self, oauth_provider, client_metadat
394398 oauth_provider .client_metadata = client_metadata
395399 token = OAuthToken (
396400 access_token = "test" ,
397- token_type = "bearer " ,
401+ token_type = "Bearer " ,
398402 scope = "read" ,
399403 )
400404
@@ -409,7 +413,7 @@ async def test_validate_token_scopes_unauthorized(
409413 oauth_provider .client_metadata = client_metadata
410414 token = OAuthToken (
411415 access_token = "test" ,
412- token_type = "bearer " ,
416+ token_type = "Bearer " ,
413417 scope = "read write admin" , # Includes unauthorized "admin"
414418 )
415419
@@ -423,7 +427,7 @@ async def test_validate_token_scopes_no_requested(self, oauth_provider):
423427 oauth_provider .client_metadata .scope = None
424428 token = OAuthToken (
425429 access_token = "test" ,
426- token_type = "bearer " ,
430+ token_type = "Bearer " ,
427431 scope = "admin super" ,
428432 )
429433
@@ -530,7 +534,7 @@ async def test_refresh_access_token_success(
530534
531535 new_token = OAuthToken (
532536 access_token = "new_access_token" ,
533- token_type = "bearer " ,
537+ token_type = "Bearer " ,
534538 expires_in = 3600 ,
535539 refresh_token = "new_refresh_token" ,
536540 scope = "read write" ,
@@ -563,7 +567,7 @@ async def test_refresh_access_token_no_refresh_token(self, oauth_provider):
563567 """Test token refresh with no refresh token."""
564568 oauth_provider ._current_tokens = OAuthToken (
565569 access_token = "test" ,
566- token_type = "bearer " ,
570+ token_type = "Bearer " ,
567571 # No refresh_token
568572 )
569573
@@ -756,7 +760,8 @@ async def test_async_auth_flow_no_token(self, oauth_provider):
756760 # No Authorization header should be added if no token
757761 assert "Authorization" not in updated_request .headers
758762
759- def test_scope_priority_client_metadata_first (
763+ @pytest .mark .anyio
764+ async def test_scope_priority_client_metadata_first (
760765 self , oauth_provider , oauth_client_info
761766 ):
762767 """Test that client metadata scope takes priority."""
@@ -785,7 +790,8 @@ def test_scope_priority_client_metadata_first(
785790
786791 assert auth_params ["scope" ] == "read write"
787792
788- def test_scope_priority_no_client_metadata_scope (
793+ @pytest .mark .anyio
794+ async def test_scope_priority_no_client_metadata_scope (
789795 self , oauth_provider , oauth_client_info
790796 ):
791797 """Test that no scope parameter is set when client metadata has no scope."""
0 commit comments