@@ -28,18 +28,22 @@ def get_client_encrypted_cert():
2828
2929def test_constructor ():
3030
31- options = client_options .ClientOptions (
32- api_endpoint = "foo.googleapis.com" ,
33- client_cert_source = get_client_cert ,
34- quota_project_id = "quote-proj" ,
35- credentials_file = "path/to/credentials.json" ,
36- scopes = [
37- "https://www.googleapis.com/auth/cloud-platform" ,
38- "https://www.googleapis.com/auth/cloud-platform.read-only" ,
39- ],
40- api_audience = "foo2.googleapis.com" ,
41- universe_domain = "googleapis.com" ,
42- )
31+ with pytest .warns (
32+ DeprecationWarning ,
33+ match = "argument is deprecated because of a potential security risk" ,
34+ ):
35+ options = client_options .ClientOptions (
36+ api_endpoint = "foo.googleapis.com" ,
37+ client_cert_source = get_client_cert ,
38+ quota_project_id = "quote-proj" ,
39+ credentials_file = "path/to/credentials.json" ,
40+ scopes = [
41+ "https://www.googleapis.com/auth/cloud-platform" ,
42+ "https://www.googleapis.com/auth/cloud-platform.read-only" ,
43+ ],
44+ api_audience = "foo2.googleapis.com" ,
45+ universe_domain = "googleapis.com" ,
46+ )
4347
4448 assert options .api_endpoint == "foo.googleapis.com"
4549 assert options .client_cert_source () == (b"cert" , b"key" )
@@ -102,10 +106,14 @@ def test_constructor_with_api_key():
102106
103107def test_constructor_with_both_api_key_and_credentials_file ():
104108 with pytest .raises (ValueError ):
105- client_options .ClientOptions (
106- api_key = "api-key" ,
107- credentials_file = "path/to/credentials.json" ,
108- )
109+ with pytest .warns (
110+ DeprecationWarning ,
111+ match = "argument is deprecated because of a potential security risk" ,
112+ ):
113+ client_options .ClientOptions (
114+ api_key = "api-key" ,
115+ credentials_file = "path/to/credentials.json" ,
116+ )
109117
110118
111119def test_from_dict ():
0 commit comments