Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.8k
fix: propagate quota_project_id and api_endpoint in AsyncGrpcClient#16731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -53,6 +53,8 @@ def test_constructor_default_options(self, mock_async_storage_client): | ||
| expected_options = (("grpc.primary_user_agent", primary_user_agent),) | ||
| mock_transport_cls.create_channel.assert_called_once_with( | ||
| host="storage.googleapis.com", | ||
chandra-siri marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| quota_project_id=None, | ||
| attempt_direct_path=True, | ||
| credentials=mock_creds, | ||
| options=expected_options, | ||
| @@ -82,6 +84,39 @@ def test_constructor_with_client_info(self, mock_async_storage_client): | ||
| expected_options = (("grpc.primary_user_agent", primary_user_agent),) | ||
| mock_transport_cls.create_channel.assert_called_once_with( | ||
| host="storage.googleapis.com", | ||
chandra-siri marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| quota_project_id=None, | ||
| attempt_direct_path=True, | ||
| credentials=mock_creds, | ||
| options=expected_options, | ||
| ) | ||
| @mock.patch("google.cloud._storage_v2.StorageAsyncClient") | ||
| def test_constructor_with_quota_project_and_endpoint( | ||
| self, mock_async_storage_client | ||
| ): | ||
| mock_transport_cls = mock.MagicMock() | ||
| mock_async_storage_client.get_transport_class.return_value = mock_transport_cls | ||
| mock_creds = _make_credentials() | ||
| from google.api_core import client_options | ||
| mock_client_options = client_options.ClientOptions( | ||
| api_endpoint="custom-endpoint.com", quota_project_id="my-quota-project" | ||
| ) | ||
| async_grpc_client.AsyncGrpcClient( | ||
| credentials=mock_creds, client_options=mock_client_options | ||
| ) | ||
| kwargs = mock_async_storage_client.call_args.kwargs | ||
| client_info = kwargs["client_info"] | ||
| primary_user_agent = client_info.to_user_agent() | ||
| expected_options = (("grpc.primary_user_agent", primary_user_agent),) | ||
| mock_transport_cls.create_channel.assert_called_once_with( | ||
| host="custom-endpoint.com", | ||
| quota_project_id="my-quota-project", | ||
| attempt_direct_path=True, | ||
| credentials=mock_creds, | ||
| options=expected_options, | ||
| @@ -105,6 +140,8 @@ def test_constructor_disables_directpath(self, mock_async_storage_client): | ||
| expected_options = (("grpc.primary_user_agent", primary_user_agent),) | ||
| mock_transport_cls.create_channel.assert_called_once_with( | ||
| host="storage.googleapis.com", | ||
chandra-siri marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| quota_project_id=None, | ||
| attempt_direct_path=False, | ||
| credentials=mock_creds, | ||
| options=expected_options, | ||
| @@ -147,6 +184,8 @@ def test_grpc_client_property(self, mock_grpc_gapic_client): | ||
| expected_options = (("grpc.primary_user_agent", primary_user_agent),) | ||
| mock_transport_cls.create_channel.assert_called_once_with( | ||
| host="storage.googleapis.com", | ||
chandra-siri marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| quota_project_id=None, | ||
| attempt_direct_path=mock_attempt_direct_path, | ||
| credentials=mock_creds, | ||
| options=expected_options, | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.