aboutsummaryrefslogtreecommitdiff
path: root/tests/test_impersonated_credentials.py
diff options
context:
space:
mode:
authorarithmetic1728 <58957152+arithmetic1728@users.noreply.github.com>2021-10-21 15:25:46 -0700
committerGitHub <noreply@github.com>2021-10-21 15:25:46 -0700
commit5bd5ccf7cf229f033c7152ce0b650a40feb25f81 (patch)
treefb08f54a8732706a7633da0d464ae3823fd3fb4b /tests/test_impersonated_credentials.py
parente2b3c98cd8c67b702be1b711c06ee7b9bbedb8ba (diff)
downloadgoogle-auth-library-python-5bd5ccf7cf229f033c7152ce0b650a40feb25f81.tar.gz
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
Diffstat (limited to 'tests/test_impersonated_credentials.py')
-rw-r--r--tests/test_impersonated_credentials.py34
1 files changed, 17 insertions, 17 deletions
diff --git a/tests/test_impersonated_credentials.py b/tests/test_impersonated_credentials.py
index 3dbb6ca..bceaeba 100644
--- a/tests/test_impersonated_credentials.py
+++ b/tests/test_impersonated_credentials.py
@@ -13,12 +13,12 @@
# limitations under the License.
import datetime
-import http.client
import json
import os
import mock
import pytest
+from six.moves import http_client
from google.auth import _helpers
from google.auth import crypt
@@ -79,7 +79,7 @@ def mock_authorizedsession_sign():
"google.auth.transport.requests.AuthorizedSession.request", autospec=True
) as auth_session:
data = {"keyId": "1", "signedBlob": "c2lnbmF0dXJl"}
- auth_session.return_value = MockResponse(data, http.client.OK)
+ auth_session.return_value = MockResponse(data, http_client.OK)
yield auth_session
@@ -89,7 +89,7 @@ def mock_authorizedsession_idtoken():
"google.auth.transport.requests.AuthorizedSession.request", autospec=True
) as auth_session:
data = {"token": ID_TOKEN_DATA}
- auth_session.return_value = MockResponse(data, http.client.OK)
+ auth_session.return_value = MockResponse(data, http_client.OK)
yield auth_session
@@ -141,7 +141,7 @@ class TestImpersonatedCredentials(object):
def make_request(
self,
data,
- status=http.client.OK,
+ status=http_client.OK,
headers=None,
side_effect=None,
use_data_bytes=True,
@@ -169,7 +169,7 @@ class TestImpersonatedCredentials(object):
request = self.make_request(
data=json.dumps(response_body),
- status=http.client.OK,
+ status=http_client.OK,
use_data_bytes=use_data_bytes,
)
@@ -194,7 +194,7 @@ class TestImpersonatedCredentials(object):
request = self.make_request(
data=json.dumps(response_body),
- status=http.client.OK,
+ status=http_client.OK,
use_data_bytes=use_data_bytes,
)
@@ -229,7 +229,7 @@ class TestImpersonatedCredentials(object):
).isoformat("T") + "Z"
response_body = {"accessToken": "token", "expireTime": expire_time}
request = self.make_request(
- data=json.dumps(response_body), status=http.client.OK
+ data=json.dumps(response_body), status=http_client.OK
)
credentials.refresh(request)
@@ -254,7 +254,7 @@ class TestImpersonatedCredentials(object):
response_body = {"accessToken": token, "expireTime": expire_time}
request = self.make_request(
- data=json.dumps(response_body), status=http.client.OK
+ data=json.dumps(response_body), status=http_client.OK
)
with pytest.raises(exceptions.RefreshError) as excinfo:
@@ -277,7 +277,7 @@ class TestImpersonatedCredentials(object):
}
request = self.make_request(
- data=json.dumps(response_body), status=http.client.UNAUTHORIZED
+ data=json.dumps(response_body), status=http_client.UNAUTHORIZED
)
with pytest.raises(exceptions.RefreshError) as excinfo:
@@ -294,7 +294,7 @@ class TestImpersonatedCredentials(object):
response_body = {}
request = self.make_request(
- data=json.dumps(response_body), status=http.client.HTTPException
+ data=json.dumps(response_body), status=http_client.HTTPException
)
with pytest.raises(exceptions.RefreshError) as excinfo:
@@ -331,7 +331,7 @@ class TestImpersonatedCredentials(object):
token_response_body = {"accessToken": token, "expireTime": expire_time}
response = mock.create_autospec(transport.Response, instance=False)
- response.status = http.client.OK
+ response.status = http_client.OK
response.data = _helpers.to_bytes(json.dumps(token_response_body))
request = mock.create_autospec(transport.Request, instance=False)
@@ -369,7 +369,7 @@ class TestImpersonatedCredentials(object):
request = self.make_request(
data=json.dumps(response_body),
- status=http.client.OK,
+ status=http_client.OK,
use_data_bytes=use_data_bytes,
)
@@ -394,7 +394,7 @@ class TestImpersonatedCredentials(object):
response_body = {"accessToken": token, "expireTime": expire_time}
request = self.make_request(
- data=json.dumps(response_body), status=http.client.OK
+ data=json.dumps(response_body), status=http_client.OK
)
credentials.refresh(request)
@@ -423,7 +423,7 @@ class TestImpersonatedCredentials(object):
response_body = {"accessToken": token, "expireTime": expire_time}
request = self.make_request(
- data=json.dumps(response_body), status=http.client.OK
+ data=json.dumps(response_body), status=http_client.OK
)
credentials.refresh(request)
@@ -453,7 +453,7 @@ class TestImpersonatedCredentials(object):
response_body = {"accessToken": token, "expireTime": expire_time}
request = self.make_request(
- data=json.dumps(response_body), status=http.client.OK
+ data=json.dumps(response_body), status=http_client.OK
)
credentials.refresh(request)
@@ -494,7 +494,7 @@ class TestImpersonatedCredentials(object):
response_body = {"accessToken": token, "expireTime": expire_time}
request = self.make_request(
- data=json.dumps(response_body), status=http.client.OK
+ data=json.dumps(response_body), status=http_client.OK
)
credentials.refresh(request)
@@ -523,7 +523,7 @@ class TestImpersonatedCredentials(object):
response_body = {"accessToken": token, "expireTime": expire_time}
request = self.make_request(
- data=json.dumps(response_body), status=http.client.OK
+ data=json.dumps(response_body), status=http_client.OK
)
credentials.refresh(request)