aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/test_client_options.py
diff options
context:
space:
mode:
authorDov Shlachter <dovs@google.com>2020-06-04 18:04:11 -0700
committerGitHub <noreply@github.com>2020-06-04 18:04:11 -0700
commita58293601d6da90c499d404e634a979a6cae9708 (patch)
treeefee1b9dc5feb8f2a8b61c508c81baf955a144ee /tests/unit/test_client_options.py
parent33ab7faf31e13759b0ec7da01f693a12b302d720 (diff)
downloadpython-api-core-a58293601d6da90c499d404e634a979a6cae9708.tar.gz
feat(client_options): add new client options 'quota_project_id', 'scopes', and 'credentials_file'
Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
Diffstat (limited to 'tests/unit/test_client_options.py')
-rw-r--r--tests/unit/test_client_options.py33
1 files changed, 30 insertions, 3 deletions
diff --git a/tests/unit/test_client_options.py b/tests/unit/test_client_options.py
index 67c4f6b..1581c56 100644
--- a/tests/unit/test_client_options.py
+++ b/tests/unit/test_client_options.py
@@ -28,11 +28,24 @@ def get_client_encrypted_cert():
def test_constructor():
options = client_options.ClientOptions(
- api_endpoint="foo.googleapis.com", client_cert_source=get_client_cert
+ api_endpoint="foo.googleapis.com",
+ client_cert_source=get_client_cert,
+ quota_project_id="quote-proj",
+ credentials_file="path/to/credentials.json",
+ scopes=[
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ ]
)
assert options.api_endpoint == "foo.googleapis.com"
assert options.client_cert_source() == (b"cert", b"key")
+ assert options.quota_project_id == "quote-proj"
+ assert options.credentials_file == "path/to/credentials.json"
+ assert options.scopes == [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ ]
def test_constructor_with_encrypted_cert_source():
@@ -61,12 +74,26 @@ def test_constructor_with_both_cert_sources():
def test_from_dict():
options = client_options.from_dict(
- {"api_endpoint": "foo.googleapis.com", "client_cert_source": get_client_cert}
+ {
+ "api_endpoint": "foo.googleapis.com",
+ "client_cert_source": get_client_cert,
+ "quota_project_id": "quote-proj",
+ "credentials_file": "path/to/credentials.json",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ ]
+ }
)
assert options.api_endpoint == "foo.googleapis.com"
- # assert options.client_cert_source == get_client_cert
assert options.client_cert_source() == (b"cert", b"key")
+ assert options.quota_project_id == "quote-proj"
+ assert options.credentials_file == "path/to/credentials.json"
+ assert options.scopes == [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ ]
def test_from_dict_bad_argument():