diff options
Diffstat (limited to 'tests_async/oauth2/test__client_async.py')
-rw-r--r-- | tests_async/oauth2/test__client_async.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tests_async/oauth2/test__client_async.py b/tests_async/oauth2/test__client_async.py index 66338d5..6e48c45 100644 --- a/tests_async/oauth2/test__client_async.py +++ b/tests_async/oauth2/test__client_async.py @@ -13,12 +13,13 @@ # limitations under the License. import datetime -import http.client import json -import urllib import mock import pytest +import six +from six.moves import http_client +from six.moves import urllib from google.auth import _helpers from google.auth import _jwt_async as jwt @@ -28,7 +29,7 @@ from google.oauth2 import _client_async as _client from tests.oauth2 import test__client as test_client -def make_request(response_data, status=http.client.OK): +def make_request(response_data, status=http_client.OK): response = mock.AsyncMock(spec=["transport.Response"]) response.status = status data = json.dumps(response_data).encode("utf-8") @@ -92,7 +93,7 @@ async def test__token_endpoint_request_json(): @pytest.mark.asyncio async def test__token_endpoint_request_error(): - request = make_request({}, status=http.client.BAD_REQUEST) + request = make_request({}, status=http_client.BAD_REQUEST) with pytest.raises(exceptions.RefreshError): await _client._token_endpoint_request(request, "http://example.com", {}) @@ -101,7 +102,7 @@ async def test__token_endpoint_request_error(): @pytest.mark.asyncio async def test__token_endpoint_request_internal_failure_error(): request = make_request( - {"error_description": "internal_failure"}, status=http.client.BAD_REQUEST + {"error_description": "internal_failure"}, status=http_client.BAD_REQUEST ) with pytest.raises(exceptions.RefreshError): @@ -110,7 +111,7 @@ async def test__token_endpoint_request_internal_failure_error(): ) request = make_request( - {"error": "internal_failure"}, status=http.client.BAD_REQUEST + {"error": "internal_failure"}, status=http_client.BAD_REQUEST ) with pytest.raises(exceptions.RefreshError): @@ -123,7 +124,7 @@ def verify_request_params(request, params): request_body = request.call_args[1]["body"].decode("utf-8") request_params = urllib.parse.parse_qs(request_body) - for key, value in params.items(): + for key, value in six.iteritems(params): assert request_params[key][0] == value |