@@ -53,6 +53,8 @@ def test_constructor_default_options(self, mock_async_storage_client):
5353 expected_options = (("grpc.primary_user_agent" , primary_user_agent ),)
5454
5555 mock_transport_cls .create_channel .assert_called_once_with (
56+ host = "storage.googleapis.com" ,
57+ quota_project_id = None ,
5658 attempt_direct_path = True ,
5759 credentials = mock_creds ,
5860 options = expected_options ,
@@ -82,6 +84,39 @@ def test_constructor_with_client_info(self, mock_async_storage_client):
8284 expected_options = (("grpc.primary_user_agent" , primary_user_agent ),)
8385
8486 mock_transport_cls .create_channel .assert_called_once_with (
87+ host = "storage.googleapis.com" ,
88+ quota_project_id = None ,
89+ attempt_direct_path = True ,
90+ credentials = mock_creds ,
91+ options = expected_options ,
92+ )
93+
94+ @mock .patch ("google.cloud._storage_v2.StorageAsyncClient" )
95+ def test_constructor_with_quota_project_and_endpoint (
96+ self , mock_async_storage_client
97+ ):
98+ mock_transport_cls = mock .MagicMock ()
99+ mock_async_storage_client .get_transport_class .return_value = mock_transport_cls
100+ mock_creds = _make_credentials ()
101+
102+ from google .api_core import client_options
103+
104+ mock_client_options = client_options .ClientOptions (
105+ api_endpoint = "custom-endpoint.com" , quota_project_id = "my-quota-project"
106+ )
107+
108+ async_grpc_client .AsyncGrpcClient (
109+ credentials = mock_creds , client_options = mock_client_options
110+ )
111+
112+ kwargs = mock_async_storage_client .call_args .kwargs
113+ client_info = kwargs ["client_info" ]
114+ primary_user_agent = client_info .to_user_agent ()
115+ expected_options = (("grpc.primary_user_agent" , primary_user_agent ),)
116+
117+ mock_transport_cls .create_channel .assert_called_once_with (
118+ host = "custom-endpoint.com" ,
119+ quota_project_id = "my-quota-project" ,
85120 attempt_direct_path = True ,
86121 credentials = mock_creds ,
87122 options = expected_options ,
@@ -105,6 +140,8 @@ def test_constructor_disables_directpath(self, mock_async_storage_client):
105140 expected_options = (("grpc.primary_user_agent" , primary_user_agent ),)
106141
107142 mock_transport_cls .create_channel .assert_called_once_with (
143+ host = "storage.googleapis.com" ,
144+ quota_project_id = None ,
108145 attempt_direct_path = False ,
109146 credentials = mock_creds ,
110147 options = expected_options ,
@@ -147,6 +184,8 @@ def test_grpc_client_property(self, mock_grpc_gapic_client):
147184 expected_options = (("grpc.primary_user_agent" , primary_user_agent ),)
148185
149186 mock_transport_cls .create_channel .assert_called_once_with (
187+ host = "storage.googleapis.com" ,
188+ quota_project_id = None ,
150189 attempt_direct_path = mock_attempt_direct_path ,
151190 credentials = mock_creds ,
152191 options = expected_options ,
0 commit comments