fix: add back python 2.7 for gcloud usage only (#892)
* fix: add back python 2.7 for gcloud
* fix: fix setup and tests
* fix: add enum34 for python 2.7
* fix: add app engine app and fix noxfile
* fix: move test_app_engine.py
* fix: fix downscoped
* fix: fix downscoped
* fix: remove py2 from classifiers
diff --git a/tests/oauth2/test__client.py b/tests/oauth2/test__client.py
index 690a87b..54686df 100644
--- a/tests/oauth2/test__client.py
+++ b/tests/oauth2/test__client.py
@@ -13,13 +13,14 @@
# limitations under the License.
import datetime
-import http.client
import json
import os
-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 crypt
@@ -74,7 +75,7 @@
assert _client._parse_expiry({}) is None
-def make_request(response_data, status=http.client.OK):
+def make_request(response_data, status=http_client.OK):
response = mock.create_autospec(transport.Response, instance=True)
response.status = status
response.data = json.dumps(response_data).encode("utf-8")
@@ -129,7 +130,7 @@
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):
_client._token_endpoint_request(request, "http://example.com", {})
@@ -137,7 +138,7 @@
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):
@@ -146,7 +147,7 @@
)
request = make_request(
- {"error": "internal_failure"}, status=http.client.BAD_REQUEST
+ {"error": "internal_failure"}, status=http_client.BAD_REQUEST
)
with pytest.raises(exceptions.RefreshError):
@@ -159,7 +160,7 @@
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