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
committerAlexander Smirnov <alex@ydb.tech>2024-01-26 20:49:32 +0300
commit487e4bd3ed1fa550b82f329ed3a76ddc3881f642 (patch)
treebf3affc512067469ce7ec2743d52529e0fae2473 /contrib/python/google-auth/py3/tests
parentde5550f847db018c6d29f627e935cc319fc98845 (diff)
downloadydb-487e4bd3ed1fa550b82f329ed3a76ddc3881f642.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"}))