aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/google-auth/py3/tests
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2024-01-26 13:18:00 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2024-01-26 14:37:14 +0300
commit7e48de06a66dff1e3f73e186f64b6d155dffa086 (patch)
treeedd6494ecf7cfca5285dbf4e5c386a20ab58e970 /contrib/python/google-auth/py3/tests
parent9b8da54607431b12327615568180adf77cca95c8 (diff)
downloadydb-7e48de06a66dff1e3f73e186f64b6d155dffa086.tar.gz
Intermediate changes
Diffstat (limited to 'contrib/python/google-auth/py3/tests')
-rw-r--r--contrib/python/google-auth/py3/tests/data/external_account_authorized_user_non_gdu.json10
-rw-r--r--contrib/python/google-auth/py3/tests/test__default.py13
2 files changed, 23 insertions, 0 deletions
diff --git a/contrib/python/google-auth/py3/tests/data/external_account_authorized_user_non_gdu.json b/contrib/python/google-auth/py3/tests/data/external_account_authorized_user_non_gdu.json
new file mode 100644
index 00000000000..b82854c7437
--- /dev/null
+++ b/contrib/python/google-auth/py3/tests/data/external_account_authorized_user_non_gdu.json
@@ -0,0 +1,10 @@
+{
+ "type": "external_account_authorized_user",
+ "audience": "//iam.fake_universe_domain/locations/global/workforcePools/$WORKFORCE_POOL_ID/providers/$PROVIDER_ID",
+ "refresh_token": "refreshToken",
+ "token_url": "https://sts.fake_universe_domain/v1/oauth/token",
+ "token_info_url": "https://sts.fake_universe_domain/v1/instrospect",
+ "client_id": "clientId",
+ "client_secret": "clientSecret",
+ "universe_domain": "fake_universe_domain"
+}
diff --git a/contrib/python/google-auth/py3/tests/test__default.py b/contrib/python/google-auth/py3/tests/test__default.py
index d619614790c..aaf892f6d04 100644
--- a/contrib/python/google-auth/py3/tests/test__default.py
+++ b/contrib/python/google-auth/py3/tests/test__default.py
@@ -158,6 +158,10 @@ EXTERNAL_ACCOUNT_AUTHORIZED_USER_FILE = os.path.join(
DATA_DIR, "external_account_authorized_user.json"
)
+EXTERNAL_ACCOUNT_AUTHORIZED_USER_NON_GDU_FILE = os.path.join(
+ DATA_DIR, "external_account_authorized_user_non_gdu.json"
+)
+
MOCK_CREDENTIALS = mock.Mock(spec=credentials.CredentialsWithQuotaProject)
MOCK_CREDENTIALS.with_quota_project.return_value = MOCK_CREDENTIALS
@@ -577,6 +581,15 @@ def test_load_credentials_from_file_external_account_authorized_user():
assert project_id is None
+def test_load_credentials_from_file_external_account_authorized_user_non_gdu():
+ credentials, _ = _default.load_credentials_from_file(
+ EXTERNAL_ACCOUNT_AUTHORIZED_USER_NON_GDU_FILE, request=mock.sentinel.request
+ )
+
+ assert isinstance(credentials, external_account_authorized_user.Credentials)
+ assert credentials.universe_domain == "fake_universe_domain"
+
+
def test_load_credentials_from_file_external_account_authorized_user_bad_format(tmpdir):
filename = tmpdir.join("external_account_authorized_user_bad.json")
filename.write(json.dumps({"type": "external_account_authorized_user"}))