aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/google-auth/py3/tests/test_credentials.py
diff options
context:
space:
mode:
authorAlexSm <alex@ydb.tech>2023-12-27 23:31:58 +0100
committerGitHub <noreply@github.com>2023-12-27 23:31:58 +0100
commitd67bfb4b4b7549081543e87a31bc6cb5c46ac973 (patch)
tree8674f2f1570877cb653e7ddcff37ba00288de15a /contrib/python/google-auth/py3/tests/test_credentials.py
parent1f6bef05ed441c3aa2d565ac792b26cded704ac7 (diff)
downloadydb-d67bfb4b4b7549081543e87a31bc6cb5c46ac973.tar.gz
Import libs 4 (#758)
Diffstat (limited to 'contrib/python/google-auth/py3/tests/test_credentials.py')
-rw-r--r--contrib/python/google-auth/py3/tests/test_credentials.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/contrib/python/google-auth/py3/tests/test_credentials.py b/contrib/python/google-auth/py3/tests/test_credentials.py
index 99235cda61..d64f3abb50 100644
--- a/contrib/python/google-auth/py3/tests/test_credentials.py
+++ b/contrib/python/google-auth/py3/tests/test_credentials.py
@@ -55,9 +55,7 @@ def test_expired_and_valid():
# Set the expiration to one second more than now plus the clock skew
# accomodation. These credentials should be valid.
credentials.expiry = (
- datetime.datetime.utcnow()
- + _helpers.REFRESH_THRESHOLD
- + datetime.timedelta(seconds=1)
+ _helpers.utcnow() + _helpers.REFRESH_THRESHOLD + datetime.timedelta(seconds=1)
)
assert credentials.valid
@@ -65,7 +63,7 @@ def test_expired_and_valid():
# Set the credentials expiration to now. Because of the clock skew
# accomodation, these credentials should report as expired.
- credentials.expiry = datetime.datetime.utcnow()
+ credentials.expiry = _helpers.utcnow()
assert not credentials.valid
assert credentials.expired
@@ -81,7 +79,7 @@ def test_before_request():
assert credentials.valid
assert credentials.token == "token"
assert headers["authorization"] == "Bearer token"
- assert "x-identity-trust-boundary" not in headers
+ assert "x-allowed-locations" not in headers
request = "token2"
headers = {}
@@ -91,13 +89,13 @@ def test_before_request():
assert credentials.valid
assert credentials.token == "token"
assert headers["authorization"] == "Bearer token"
- assert "x-identity-trust-boundary" not in headers
+ assert "x-allowed-locations" not in headers
def test_before_request_with_trust_boundary():
- DUMMY_BOUNDARY = "00110101"
+ DUMMY_BOUNDARY = "0xA30"
credentials = CredentialsImpl()
- credentials._trust_boundary = DUMMY_BOUNDARY
+ credentials._trust_boundary = {"locations": [], "encoded_locations": DUMMY_BOUNDARY}
request = "token"
headers = {}
@@ -106,7 +104,7 @@ def test_before_request_with_trust_boundary():
assert credentials.valid
assert credentials.token == "token"
assert headers["authorization"] == "Bearer token"
- assert headers["x-identity-trust-boundary"] == DUMMY_BOUNDARY
+ assert headers["x-allowed-locations"] == DUMMY_BOUNDARY
request = "token2"
headers = {}
@@ -116,7 +114,7 @@ def test_before_request_with_trust_boundary():
assert credentials.valid
assert credentials.token == "token"
assert headers["authorization"] == "Bearer token"
- assert headers["x-identity-trust-boundary"] == DUMMY_BOUNDARY
+ assert headers["x-allowed-locations"] == DUMMY_BOUNDARY
def test_before_request_metrics():