diff options
author | arithmetic1728 <58957152+arithmetic1728@users.noreply.github.com> | 2020-06-17 23:36:04 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-18 06:36:04 +0000 |
commit | f30b45a9b2f824c494724548732c5ce838218c30 (patch) | |
tree | 3f5a03358273151182a2946cf4c5be29ce84304f /tests | |
parent | b74168b710da38c0cf06cdf8685c49af4748e3a0 (diff) | |
download | google-auth-library-python-f30b45a9b2f824c494724548732c5ce838218c30.tar.gz |
fix: no warning if quota_project_id is given (#537)
If user account cred has 'quota_project_id', ignore the warning.
Implementing http://shortn/_YUlAgzL40H
Diffstat (limited to 'tests')
-rw-r--r-- | tests/data/authorized_user_cloud_sdk_with_quota_project_id.json | 7 | ||||
-rw-r--r-- | tests/test__default.py | 11 |
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/data/authorized_user_cloud_sdk_with_quota_project_id.json b/tests/data/authorized_user_cloud_sdk_with_quota_project_id.json new file mode 100644 index 0000000..53a8ff8 --- /dev/null +++ b/tests/data/authorized_user_cloud_sdk_with_quota_project_id.json @@ -0,0 +1,7 @@ +{ + "client_id": "764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com", + "client_secret": "secret", + "refresh_token": "alabalaportocala", + "type": "authorized_user", + "quota_project_id": "quota_project_id" +} diff --git a/tests/test__default.py b/tests/test__default.py index 35000b0..b769fc7 100644 --- a/tests/test__default.py +++ b/tests/test__default.py @@ -37,6 +37,10 @@ AUTHORIZED_USER_CLOUD_SDK_FILE = os.path.join( DATA_DIR, "authorized_user_cloud_sdk.json" ) +AUTHORIZED_USER_CLOUD_SDK_WITH_QUOTA_PROJECT_ID_FILE = os.path.join( + DATA_DIR, "authorized_user_cloud_sdk_with_quota_project_id.json" +) + SERVICE_ACCOUNT_FILE = os.path.join(DATA_DIR, "service_account.json") with open(SERVICE_ACCOUNT_FILE) as fh: @@ -101,6 +105,13 @@ def test__load_credentials_from_file_authorized_user_cloud_sdk(): assert isinstance(credentials, google.oauth2.credentials.Credentials) assert project_id is None + # No warning if the json file has quota project id. + credentials, project_id = _default._load_credentials_from_file( + AUTHORIZED_USER_CLOUD_SDK_WITH_QUOTA_PROJECT_ID_FILE + ) + assert isinstance(credentials, google.oauth2.credentials.Credentials) + assert project_id is None + def test__load_credentials_from_file_service_account(): credentials, project_id = _default._load_credentials_from_file(SERVICE_ACCOUNT_FILE) |