Skip to content

Commit d854fe5

Browse files
committed
Update some tests
1 parent 4b5051c commit d854fe5

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

tests/aio/test_aio_client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -985,8 +985,9 @@ async def test_oauth_authorization_header():
985985
client._skip_analytics = "1"
986986

987987
# Mock the Auth.get() method to return a test token
988-
test_token = "Bearer test_oauth_token_xyz"
989-
with mock.patch.object(client.auth, "get", return_value=test_token):
988+
test_token = "test_oauth_token_xyz"
989+
client.auth._access_token = test_token
990+
with mock.patch.object(client.auth, "_is_token_expired", return_value=False):
990991
# Make a request
991992
await client.get_project_settings()
992993

@@ -997,4 +998,4 @@ async def test_oauth_authorization_header():
997998
# Verify Authorization header is set correctly
998999
assert "headers" in call_kwargs
9991000
assert "Authorization" in call_kwargs["headers"]
1000-
assert call_kwargs["headers"]["Authorization"] == test_token
1001+
assert call_kwargs["headers"]["Authorization"] == f"Bearer {test_token}"

tests/test_client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,9 @@ def test_oauth_authorization_header():
486486
client._skip_analytics = "1"
487487

488488
# Mock the Auth.get() method to return a test token
489-
test_token = "Bearer test_oauth_token_xyz"
490-
with mock.patch.object(client.auth, "get", return_value=test_token):
489+
test_token = "test_oauth_token_xyz"
490+
client.auth._access_token = test_token
491+
with mock.patch.object(client.auth, "_is_token_expired", return_value=False):
491492
# Make a request
492493
client.get_project_settings()
493494

@@ -498,4 +499,4 @@ def test_oauth_authorization_header():
498499
# Verify Authorization header is set correctly
499500
assert "headers" in call_kwargs
500501
assert "Authorization" in call_kwargs["headers"]
501-
assert call_kwargs["headers"]["Authorization"] == test_token
502+
assert call_kwargs["headers"]["Authorization"] == f"Bearer {test_token}"

0 commit comments

Comments
 (0)