@@ -91,7 +91,7 @@ def oauth_client_info():
91
91
def oauth_token ():
92
92
return OAuthToken (
93
93
access_token = "test_access_token" ,
94
- token_type = "bearer " ,
94
+ token_type = "Bearer " ,
95
95
expires_in = 3600 ,
96
96
refresh_token = "test_refresh_token" ,
97
97
scope = "read write" ,
@@ -143,7 +143,8 @@ def test_generate_code_verifier(self, oauth_provider):
143
143
verifiers = {oauth_provider ._generate_code_verifier () for _ in range (10 )}
144
144
assert len (verifiers ) == 10
145
145
146
- def test_generate_code_challenge (self , oauth_provider ):
146
+ @pytest .mark .anyio
147
+ async def test_generate_code_challenge (self , oauth_provider ):
147
148
"""Test PKCE code challenge generation."""
148
149
verifier = "test_code_verifier_123"
149
150
challenge = oauth_provider ._generate_code_challenge (verifier )
@@ -161,7 +162,8 @@ def test_generate_code_challenge(self, oauth_provider):
161
162
assert "+" not in challenge
162
163
assert "/" not in challenge
163
164
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 ):
165
167
"""Test authorization base URL extraction."""
166
168
# Test with path
167
169
assert (
@@ -348,11 +350,13 @@ async def test_register_oauth_client_failure(self, oauth_provider):
348
350
None ,
349
351
)
350
352
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 ):
352
355
"""Test token validation with no token."""
353
356
assert not oauth_provider ._has_valid_token ()
354
357
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 ):
356
360
"""Test token validation with valid token."""
357
361
oauth_provider ._current_tokens = oauth_token
358
362
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):
370
374
@pytest .mark .anyio
371
375
async def test_validate_token_scopes_no_scope (self , oauth_provider ):
372
376
"""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 " )
374
378
375
379
# Should not raise exception
376
380
await oauth_provider ._validate_token_scopes (token )
@@ -381,7 +385,7 @@ async def test_validate_token_scopes_valid(self, oauth_provider, client_metadata
381
385
oauth_provider .client_metadata = client_metadata
382
386
token = OAuthToken (
383
387
access_token = "test" ,
384
- token_type = "bearer " ,
388
+ token_type = "Bearer " ,
385
389
scope = "read write" ,
386
390
)
387
391
@@ -394,7 +398,7 @@ async def test_validate_token_scopes_subset(self, oauth_provider, client_metadat
394
398
oauth_provider .client_metadata = client_metadata
395
399
token = OAuthToken (
396
400
access_token = "test" ,
397
- token_type = "bearer " ,
401
+ token_type = "Bearer " ,
398
402
scope = "read" ,
399
403
)
400
404
@@ -409,7 +413,7 @@ async def test_validate_token_scopes_unauthorized(
409
413
oauth_provider .client_metadata = client_metadata
410
414
token = OAuthToken (
411
415
access_token = "test" ,
412
- token_type = "bearer " ,
416
+ token_type = "Bearer " ,
413
417
scope = "read write admin" , # Includes unauthorized "admin"
414
418
)
415
419
@@ -423,7 +427,7 @@ async def test_validate_token_scopes_no_requested(self, oauth_provider):
423
427
oauth_provider .client_metadata .scope = None
424
428
token = OAuthToken (
425
429
access_token = "test" ,
426
- token_type = "bearer " ,
430
+ token_type = "Bearer " ,
427
431
scope = "admin super" ,
428
432
)
429
433
@@ -530,7 +534,7 @@ async def test_refresh_access_token_success(
530
534
531
535
new_token = OAuthToken (
532
536
access_token = "new_access_token" ,
533
- token_type = "bearer " ,
537
+ token_type = "Bearer " ,
534
538
expires_in = 3600 ,
535
539
refresh_token = "new_refresh_token" ,
536
540
scope = "read write" ,
@@ -563,7 +567,7 @@ async def test_refresh_access_token_no_refresh_token(self, oauth_provider):
563
567
"""Test token refresh with no refresh token."""
564
568
oauth_provider ._current_tokens = OAuthToken (
565
569
access_token = "test" ,
566
- token_type = "bearer " ,
570
+ token_type = "Bearer " ,
567
571
# No refresh_token
568
572
)
569
573
@@ -756,7 +760,8 @@ async def test_async_auth_flow_no_token(self, oauth_provider):
756
760
# No Authorization header should be added if no token
757
761
assert "Authorization" not in updated_request .headers
758
762
759
- def test_scope_priority_client_metadata_first (
763
+ @pytest .mark .anyio
764
+ async def test_scope_priority_client_metadata_first (
760
765
self , oauth_provider , oauth_client_info
761
766
):
762
767
"""Test that client metadata scope takes priority."""
@@ -785,7 +790,8 @@ def test_scope_priority_client_metadata_first(
785
790
786
791
assert auth_params ["scope" ] == "read write"
787
792
788
- def test_scope_priority_no_client_metadata_scope (
793
+ @pytest .mark .anyio
794
+ async def test_scope_priority_no_client_metadata_scope (
789
795
self , oauth_provider , oauth_client_info
790
796
):
791
797
"""Test that no scope parameter is set when client metadata has no scope."""
0 commit comments