aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/test_client_options.py
diff options
context:
space:
mode:
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():