summaryrefslogtreecommitdiffstats
path: root/contrib/python/google-auth/py3/tests/oauth2/test_credentials.py
diff options
context:
space:
mode:
authorrobot-piglet <[email protected]>2024-10-06 13:42:43 +0300
committerrobot-piglet <[email protected]>2024-10-06 13:52:30 +0300
commit52aed29f744afda4549ef5d64acd0fa8c2092789 (patch)
treee40c9abd25653990d13b68936aee518454df424e /contrib/python/google-auth/py3/tests/oauth2/test_credentials.py
parent813943fcad905eee1235d764be4268dddd07ce64 (diff)
Intermediate changes
commit_hash:cc4365f5a0e443b92d87079a9c91e77fea2ddcaf
Diffstat (limited to 'contrib/python/google-auth/py3/tests/oauth2/test_credentials.py')
-rw-r--r--contrib/python/google-auth/py3/tests/oauth2/test_credentials.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/contrib/python/google-auth/py3/tests/oauth2/test_credentials.py b/contrib/python/google-auth/py3/tests/oauth2/test_credentials.py
index 67b6b9c1ad3..a4cac7a4639 100644
--- a/contrib/python/google-auth/py3/tests/oauth2/test_credentials.py
+++ b/contrib/python/google-auth/py3/tests/oauth2/test_credentials.py
@@ -72,6 +72,34 @@ class TestCredentials(object):
assert credentials.rapt_token == self.RAPT_TOKEN
assert credentials.refresh_handler is None
+ def test_get_cred_info(self):
+ credentials = self.make_credentials()
+ credentials._account = "fake-account"
+ assert not credentials.get_cred_info()
+
+ credentials._cred_file_path = "/path/to/file"
+ assert credentials.get_cred_info() == {
+ "credential_source": "/path/to/file",
+ "credential_type": "user credentials",
+ "principal": "fake-account",
+ }
+
+ def test_get_cred_info_no_account(self):
+ credentials = self.make_credentials()
+ assert not credentials.get_cred_info()
+
+ credentials._cred_file_path = "/path/to/file"
+ assert credentials.get_cred_info() == {
+ "credential_source": "/path/to/file",
+ "credential_type": "user credentials",
+ }
+
+ def test__make_copy_get_cred_info(self):
+ credentials = self.make_credentials()
+ credentials._cred_file_path = "/path/to/file"
+ cred_copy = credentials._make_copy()
+ assert cred_copy._cred_file_path == "/path/to/file"
+
def test_token_usage_metrics(self):
credentials = self.make_credentials()
credentials.token = "token"