Skip to content

Commit e18e606

Browse files
authored
Merge pull request #5 from sacha-development-stuff/codex/fix-attributeerror-in-pytest-test-case
Fix OAuth tests using async fixtures
2 parents 103e201 + ad59c92 commit e18e606

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tests/client/test_auth.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ async def test_init(self, oauth_provider, client_metadata, mock_storage):
156156
assert oauth_provider.timeout == 300.0
157157

158158
@pytest.mark.anyio
159-
def test_generate_code_verifier(self, oauth_provider):
159+
async def test_generate_code_verifier(self, oauth_provider):
160160
"""Test PKCE code verifier generation."""
161161
verifier = oauth_provider._generate_code_verifier()
162162

@@ -174,7 +174,7 @@ def test_generate_code_verifier(self, oauth_provider):
174174
assert len(verifiers) == 10
175175

176176
@pytest.mark.anyio
177-
def test_generate_code_challenge(self, oauth_provider):
177+
async def test_generate_code_challenge(self, oauth_provider):
178178
"""Test PKCE code challenge generation."""
179179
verifier = "test_code_verifier_123"
180180
challenge = oauth_provider._generate_code_challenge(verifier)
@@ -193,7 +193,7 @@ def test_generate_code_challenge(self, oauth_provider):
193193
assert "/" not in challenge
194194

195195
@pytest.mark.anyio
196-
def test_get_authorization_base_url(self, oauth_provider):
196+
async def test_get_authorization_base_url(self, oauth_provider):
197197
"""Test authorization base URL extraction."""
198198
# Test with path
199199
assert (
@@ -369,12 +369,12 @@ async def test_register_oauth_client_failure(self, oauth_provider):
369369
)
370370

371371
@pytest.mark.anyio
372-
def test_has_valid_token_no_token(self, oauth_provider):
372+
async def test_has_valid_token_no_token(self, oauth_provider):
373373
"""Test token validation with no token."""
374374
assert not oauth_provider._has_valid_token()
375375

376376
@pytest.mark.anyio
377-
def test_has_valid_token_valid(self, oauth_provider, oauth_token):
377+
async def test_has_valid_token_valid(self, oauth_provider, oauth_token):
378378
"""Test token validation with valid token."""
379379
oauth_provider._current_tokens = oauth_token
380380
oauth_provider._token_expiry_time = time.time() + 3600 # Future expiry
@@ -779,7 +779,7 @@ async def test_async_auth_flow_no_token(self, oauth_provider):
779779
assert "Authorization" not in updated_request.headers
780780

781781
@pytest.mark.anyio
782-
def test_scope_priority_client_metadata_first(
782+
async def test_scope_priority_client_metadata_first(
783783
self, oauth_provider, oauth_client_info
784784
):
785785
"""Test that client metadata scope takes priority."""
@@ -809,7 +809,7 @@ def test_scope_priority_client_metadata_first(
809809
assert auth_params["scope"] == "read write"
810810

811811
@pytest.mark.anyio
812-
def test_scope_priority_no_client_metadata_scope(
812+
async def test_scope_priority_no_client_metadata_scope(
813813
self, oauth_provider, oauth_client_info
814814
):
815815
"""Test that no scope parameter is set when client metadata has no scope."""

0 commit comments

Comments
 (0)