Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Async certificate retrieving #1101

Merged
merged 6 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions google/oauth2/_id_token_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ async def _fetch_certs(request, certs_url):
"Could not fetch certificates at {}".format(certs_url)
)

data = await response.data.read()
data = await response.content()

return json.loads(data.decode("utf-8"))
return json.loads(data)


async def verify_token(
Expand Down
3 changes: 3 additions & 0 deletions tests_async/oauth2/test_id_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ def make_request(status, data=None):
response.data.read = mock.AsyncMock(
spec=["__call__"], return_value=json.dumps(data).encode("utf-8")
)
clundin25 marked this conversation as resolved.
Show resolved Hide resolved
response.content = mock.AsyncMock(
spec=["__call__"], return_value=json.dumps(data).encode("utf-8")
)

request = mock.AsyncMock(spec=["transport.Request"])
request.return_value = response
Expand Down