Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Add google.oauth2._client#13

Merged
theacodes merged 2 commits intomasterfrom
oauth2client
Oct 7, 2016
Merged

Add google.oauth2._client#13
theacodes merged 2 commits intomasterfrom
oauth2client

Conversation

@theacodes
Copy link
Copy Markdown
Contributor

(branch name unrelated)

@theacodes theacodes added this to the 1.0.0 milestone Oct 7, 2016
@theacodes
Copy link
Copy Markdown
Contributor Author

Comment thread google/oauth2/_client.py
error_data['error'],
error_data.get('error_description')])
# If not details could be extracted, use the response data.
except (KeyError, ValueError):

This comment was marked as spam.

This comment was marked as spam.

Comment thread google/oauth2/_client.py Outdated
specified.
"""
expires_in = response_data.get('expires_in', None)
if expires_in:

This comment was marked as spam.

This comment was marked as spam.

Comment thread google/oauth2/_client.py
return _helpers.utcnow() + datetime.timedelta(
seconds=expires_in)
else:
return None

This comment was marked as spam.

This comment was marked as spam.

Comment thread google/oauth2/_client.py Outdated
"""
body = urllib.parse.urlencode(body)
headers = {
'content-type': 'application/x-www-form-urlencoded',

This comment was marked as spam.

This comment was marked as spam.

Comment thread google/oauth2/_client.py
response = request(
method='POST', url=token_uri, headers=headers, body=body)

response_body = response.data.decode('utf-8')

This comment was marked as spam.

This comment was marked as spam.

Comment thread google/oauth2/_client.py Outdated

response_data = _token_endpoint_request(request, token_uri, body)

access_token = response_data['access_token']

This comment was marked as spam.

This comment was marked as spam.

import json

import mock
import pytest

This comment was marked as spam.

This comment was marked as spam.

def test__handle_error_response():
response_data = json.dumps({
'error': 'help',
'error_description': 'I\'m alive'})

This comment was marked as spam.

This comment was marked as spam.

with pytest.raises(exceptions.RefreshError) as excinfo:
_client._handle_error_response(response_data)

assert excinfo.match(r'help: I\'m alive')

This comment was marked as spam.

This comment was marked as spam.

Comment thread tests/oauth2/test__client.py Outdated
assert _client._parse_expiry({}) is None


def test__token_endpoint_request():

This comment was marked as spam.

This comment was marked as spam.

@dhermes
Copy link
Copy Markdown
Contributor

dhermes commented Oct 7, 2016

LGTM

@theacodes theacodes merged commit 123a48b into master Oct 7, 2016
@theacodes theacodes deleted the oauth2client branch October 7, 2016 22:33
@theacodes theacodes mentioned this pull request Oct 21, 2016
12 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants