| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8b7fbde commit 17828ea
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -55,6 +55,10 @@ def __init__( | |||
| 55 | 55 | attempt_direct_path=True, | |
| 56 | 56 | ): | |
| 57 | 57 | if isinstance(credentials, auth_credentials.AnonymousCredentials): | |
| 58 | + if client_options is None or client_options.api_endpoint is None: | ||
| 59 | + raise ValueError( | ||
| 60 | + "Either client_options or `client_option.api_endpoint` is None. Please provide api_endpoint when `AnonymousCredentials` is used " | ||
| 61 | + ) | ||
| 58 | 62 | self._grpc_client = self._create_anonymous_client( | |
| 59 | 63 | client_options, credentials | |
| 60 | 64 | ) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -184,6 +184,23 @@ def test_grpc_client_with_anon_creds( | |||
| 184 | 184 | transport = kwargs["transport"] | |
| 185 | 185 | assert isinstance(transport._credentials, AnonymousCredentials) | |
| 186 | 186 | ||
| 187 | + def test_grpc_client_with_anon_creds_no_client_options(self): | ||
| 188 | + # Act & Assert | ||
| 189 | + message = "Either client_options or `client_option.api_endpoint` is None. Please provide api_endpoint when `AnonymousCredentials` is used " | ||
| 190 | + with pytest.raises(ValueError, match=message): | ||
| 191 | + async_grpc_client.AsyncGrpcClient( | ||
| 192 | + credentials=AnonymousCredentials(), | ||
| 193 | + ) | ||
| 194 | + | ||
| 195 | + def test_grpc_client_with_anon_creds_empty_client_options(self): | ||
| 196 | + # Act & Assert | ||
| 197 | + message = "Either client_options or `client_option.api_endpoint` is None. Please provide api_endpoint when `AnonymousCredentials` is used " | ||
| 198 | + with pytest.raises(ValueError, match=message): | ||
| 199 | + async_grpc_client.AsyncGrpcClient( | ||
| 200 | + client_options=client_options.ClientOptions(), | ||
| 201 | + credentials=AnonymousCredentials(), | ||
| 202 | + ) | ||
| 203 | + | ||
| 187 | 204 | @mock.patch("google.cloud._storage_v2.StorageAsyncClient") | |
| 188 | 205 | def test_user_agent_with_custom_client_info(self, mock_async_storage_client): | |
| 189 | 206 | """Test that gcloud-python user agent is appended to existing user agent. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments