google-cloud-storage 3.17.0__tar.gz → 3.17.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {google_cloud_storage-3.17.0/google_cloud_storage.egg-info → google_cloud_storage-3.17.2}/PKG-INFO +1 -1
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/_storage/gapic_version.py +1 -1
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/_storage_v2/gapic_version.py +1 -1
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/asyncio/async_grpc_client.py +25 -9
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/grpc_client.py +91 -5
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/version.py +1 -1
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2/google_cloud_storage.egg-info}/PKG-INFO +1 -1
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/asyncio/test_async_grpc_client.py +202 -7
- google_cloud_storage-3.17.2/tests/unit/test_grpc_client.py +378 -0
- google_cloud_storage-3.17.0/tests/unit/test_grpc_client.py +0 -199
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/LICENSE +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/MANIFEST.in +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/README.rst +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/_storage/__init__.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/_storage/py.typed +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/_storage_v2/__init__.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/_storage_v2/_compat.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/_storage_v2/gapic_metadata.json +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/_storage_v2/py.typed +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/_storage_v2/services/__init__.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/_storage_v2/services/storage/__init__.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/_storage_v2/services/storage/async_client.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/_storage_v2/services/storage/client.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/_storage_v2/services/storage/pagers.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/_storage_v2/services/storage/transports/__init__.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/_storage_v2/services/storage/transports/base.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/_storage_v2/services/storage/transports/grpc.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/_storage_v2/services/storage/transports/grpc_asyncio.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/_storage_v2/types/__init__.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/_storage_v2/types/storage.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/__init__.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_bucket_metadata_cache.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_experimental/asyncio/_utils.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_experimental/asyncio/async_abstract_object_stream.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_experimental/asyncio/async_appendable_object_writer.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_experimental/asyncio/async_grpc_client.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_experimental/asyncio/async_multi_range_downloader.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_experimental/asyncio/async_read_object_stream.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_experimental/asyncio/async_write_object_stream.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_experimental/asyncio/retry/_helpers.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_experimental/asyncio/retry/base_strategy.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_experimental/asyncio/retry/bidi_stream_retry_manager.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_experimental/asyncio/retry/reads_resumption_strategy.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_experimental/asyncio/retry/writes_resumption_strategy.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_experimental/grpc_client.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_grpc_conversions.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_helpers.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_http.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_lru_cache.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_media/__init__.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_media/_download.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_media/_helpers.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_media/_upload.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_media/common.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_media/py.typed +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_media/requests/__init__.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_media/requests/_request_helpers.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_media/requests/download.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_media/requests/upload.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_opentelemetry_metrics.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_opentelemetry_tracing.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/_signing.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/acl.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/asyncio/_stream_multiplexer.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/asyncio/_utils.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/asyncio/async_abstract_object_stream.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/asyncio/async_appendable_object_writer.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/asyncio/async_multi_range_downloader.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/asyncio/async_read_object_stream.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/asyncio/async_write_object_stream.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/asyncio/retry/_helpers.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/asyncio/retry/base_strategy.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/asyncio/retry/bidi_stream_retry_manager.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/asyncio/retry/reads_resumption_strategy.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/asyncio/retry/writes_resumption_strategy.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/batch.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/blob.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/bucket.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/client.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/constants.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/exceptions.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/fileio.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/hmac_key.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/iam.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/ip_filter.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/notification.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/retry.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/transfer_manager.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google_cloud_storage.egg-info/SOURCES.txt +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google_cloud_storage.egg-info/dependency_links.txt +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google_cloud_storage.egg-info/not-zip-safe +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google_cloud_storage.egg-info/requires.txt +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google_cloud_storage.egg-info/top_level.txt +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/setup.cfg +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/setup.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/__init__.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/conformance/README.md +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/conformance/__init__.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/conformance/_utils.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/conformance/conftest.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/conformance/retry_strategy_test_data.json +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/conformance/test_bidi_reads.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/conformance/test_bidi_writes.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/conformance/test_conformance.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/data/CloudPlatform_128px_Retina.png +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/data/five-point-one-mb-file.zip +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/data/random_9_MiB_file +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/data/simple.txt +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/README.md +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/__init__.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/_perf_utils.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/benchmarking.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/microbenchmarks/README.md +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/microbenchmarks/__init__.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/microbenchmarks/_utils.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/microbenchmarks/conftest.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/microbenchmarks/json_to_csv.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/microbenchmarks/parameters.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/microbenchmarks/reads/__init__.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/microbenchmarks/reads/config.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/microbenchmarks/reads/config.yaml +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/microbenchmarks/reads/parameters.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/microbenchmarks/reads/test_reads.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/microbenchmarks/resource_monitor.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/microbenchmarks/time_based/conftest.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/microbenchmarks/time_based/reads/config.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/microbenchmarks/time_based/reads/config.yaml +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/microbenchmarks/time_based/reads/parameters.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/microbenchmarks/time_based/reads/test_reads.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/microbenchmarks/writes/__init__.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/microbenchmarks/writes/config.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/microbenchmarks/writes/config.yaml +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/microbenchmarks/writes/parameters.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/microbenchmarks/writes/test_writes.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/perf/profile_w1r3.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/resumable_media/__init__.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/resumable_media/data/brotli.txt +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/resumable_media/data/brotli.txt.br +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/resumable_media/data/favicon.ico +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/resumable_media/data/file.txt +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/resumable_media/data/gzipped.txt +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/resumable_media/data/gzipped.txt.gz +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/resumable_media/data/image1.jpg +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/resumable_media/data/image2.jpg +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/resumable_media/system/__init__.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/resumable_media/system/credentials.json.enc +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/resumable_media/system/requests/__init__.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/resumable_media/system/requests/conftest.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/resumable_media/system/requests/test_download.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/resumable_media/system/requests/test_upload.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/resumable_media/system/utils.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/resumable_media/unit/__init__.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/resumable_media/unit/requests/__init__.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/resumable_media/unit/requests/test__helpers.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/resumable_media/unit/requests/test_download.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/resumable_media/unit/requests/test_upload.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/resumable_media/unit/test__download.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/resumable_media/unit/test__helpers.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/resumable_media/unit/test__upload.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/system/__init__.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/system/_helpers.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/system/conftest.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/system/test__signing.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/system/test_aco_observability.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/system/test_blob.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/system/test_bucket.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/system/test_client.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/system/test_fileio.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/system/test_hmac_key_metadata.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/system/test_kms_integration.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/system/test_notification.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/system/test_rapid.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/system/test_transfer_manager.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/__init__.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/asyncio/retry/test_bidi_stream_retry_manager.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/asyncio/retry/test_reads_resumption_strategy.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/asyncio/retry/test_writes_resumption_strategy.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/asyncio/test_async_appendable_object_writer.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/asyncio/test_async_multi_range_downloader.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/asyncio/test_async_read_object_stream.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/asyncio/test_async_write_object_stream.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/asyncio/test_bidi_async.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/asyncio/test_stream_multiplexer.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/conftest.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/gapic/__init__.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/gapic/_storage_v2/__init__.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/gapic/_storage_v2/test_compat.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/gapic/_storage_v2/test_storage.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/test__bucket_metadata_cache.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/test__grpc_conversions.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/test__helpers.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/test__http.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/test__lru_cache.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/test__opentelemetry_metrics.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/test__opentelemetry_tracing.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/test__signing.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/test_acl.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/test_batch.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/test_blob.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/test_bucket.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/test_client.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/test_exceptions.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/test_fileio.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/test_hmac_key.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/test_ip_filter.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/test_notification.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/test_retry.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/test_transfer_manager.py +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/url_signer_v4_test_account.json +0 -0
- {google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/tests/unit/url_signer_v4_test_data.json +0 -0
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
"""An async client for interacting with Google Cloud Storage using the gRPC API."""
|
|
16
16
|
|
|
17
|
+
import google.auth
|
|
17
18
|
import grpc
|
|
18
19
|
from google.auth import credentials as auth_credentials
|
|
19
20
|
|
|
@@ -22,8 +23,11 @@ from google.cloud._storage_v2.services.storage.transports.base import (
|
|
|
22
23
|
DEFAULT_CLIENT_INFO,
|
|
23
24
|
)
|
|
24
25
|
from google.cloud.storage import __version__
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
from google.cloud.storage.grpc_client import (
|
|
27
|
+
_resolve_grpc_config,
|
|
28
|
+
_resolve_universe_domain,
|
|
29
|
+
_validate_universe_domain,
|
|
30
|
+
)
|
|
27
31
|
|
|
28
32
|
|
|
29
33
|
def _validate_metadata(metadata):
|
|
@@ -78,6 +82,7 @@ class AsyncGrpcClient:
|
|
|
78
82
|
raise ValueError(
|
|
79
83
|
"Either client_options or `client_option.api_endpoint` is None. Please provide api_endpoint when `AnonymousCredentials` is used "
|
|
80
84
|
)
|
|
85
|
+
self._universe_domain = _resolve_universe_domain(client_options)
|
|
81
86
|
self._grpc_client = self._create_anonymous_client(
|
|
82
87
|
client_options, credentials
|
|
83
88
|
)
|
|
@@ -92,6 +97,7 @@ class AsyncGrpcClient:
|
|
|
92
97
|
if agent_version not in client_info.user_agent:
|
|
93
98
|
client_info.user_agent += f" {agent_version} "
|
|
94
99
|
|
|
100
|
+
self._universe_domain = _resolve_universe_domain(client_options)
|
|
95
101
|
self._grpc_client = self._create_async_grpc_client(
|
|
96
102
|
credentials=credentials,
|
|
97
103
|
client_info=client_info,
|
|
@@ -99,6 +105,11 @@ class AsyncGrpcClient:
|
|
|
99
105
|
attempt_direct_path=attempt_direct_path,
|
|
100
106
|
)
|
|
101
107
|
|
|
108
|
+
@property
|
|
109
|
+
def universe_domain(self) -> str:
|
|
110
|
+
"""The universe domain used by the client instance."""
|
|
111
|
+
return self._universe_domain
|
|
112
|
+
|
|
102
113
|
def _create_anonymous_client(self, client_options, credentials):
|
|
103
114
|
channel = grpc.aio.insecure_channel(client_options.api_endpoint)
|
|
104
115
|
transport = storage_v2.services.storage.transports.StorageGrpcAsyncIOTransport(
|
|
@@ -121,18 +132,23 @@ class AsyncGrpcClient:
|
|
|
121
132
|
client_options=None,
|
|
122
133
|
attempt_direct_path=True,
|
|
123
134
|
):
|
|
135
|
+
(
|
|
136
|
+
universe_domain,
|
|
137
|
+
host,
|
|
138
|
+
quota_project_id,
|
|
139
|
+
attempt_direct_path,
|
|
140
|
+
) = _resolve_grpc_config(client_options, attempt_direct_path)
|
|
124
141
|
transport_cls = storage_v2.StorageAsyncClient.get_transport_class(
|
|
125
142
|
"grpc_asyncio"
|
|
126
143
|
)
|
|
144
|
+
if credentials is None:
|
|
145
|
+
credentials, _ = google.auth.default(
|
|
146
|
+
default_scopes=transport_cls.AUTH_SCOPES
|
|
147
|
+
)
|
|
148
|
+
_validate_universe_domain(universe_domain, credentials)
|
|
127
149
|
|
|
128
150
|
primary_user_agent = client_info.to_user_agent()
|
|
129
151
|
|
|
130
|
-
host = _DEFAULT_HOST
|
|
131
|
-
quota_project_id = None
|
|
132
|
-
if client_options:
|
|
133
|
-
host = getattr(client_options, "api_endpoint", None) or _DEFAULT_HOST
|
|
134
|
-
quota_project_id = getattr(client_options, "quota_project_id", None)
|
|
135
|
-
|
|
136
152
|
channel = transport_cls.create_channel(
|
|
137
153
|
host=host,
|
|
138
154
|
quota_project_id=quota_project_id,
|
|
@@ -140,7 +156,7 @@ class AsyncGrpcClient:
|
|
|
140
156
|
credentials=credentials,
|
|
141
157
|
options=(("grpc.primary_user_agent", primary_user_agent),),
|
|
142
158
|
)
|
|
143
|
-
transport = transport_cls(channel=channel)
|
|
159
|
+
transport = transport_cls(host=host, channel=channel)
|
|
144
160
|
|
|
145
161
|
return storage_v2.StorageAsyncClient(
|
|
146
162
|
transport=transport,
|
{google_cloud_storage-3.17.0 → google_cloud_storage-3.17.2}/google/cloud/storage/grpc_client.py
RENAMED
|
@@ -14,11 +14,73 @@
|
|
|
14
14
|
|
|
15
15
|
"""A client for interacting with Google Cloud Storage using the gRPC API."""
|
|
16
16
|
|
|
17
|
+
import os
|
|
18
|
+
|
|
19
|
+
from google.api_core import universe
|
|
20
|
+
from google.auth import credentials as auth_credentials
|
|
17
21
|
from google.cloud.client import ClientWithProject
|
|
18
22
|
|
|
19
23
|
from google.cloud import _storage_v2 as storage_v2
|
|
24
|
+
from google.cloud._storage_v2._compat import get_universe_domain
|
|
20
25
|
|
|
21
26
|
_marker = object()
|
|
27
|
+
_DEFAULT_UNIVERSE_DOMAIN = universe.DEFAULT_UNIVERSE
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _get_option(client_options, name):
|
|
31
|
+
"""Reads an option from a dict, a ``ClientOptions`` instance, or ``None``."""
|
|
32
|
+
if isinstance(client_options, dict):
|
|
33
|
+
return client_options.get(name)
|
|
34
|
+
return getattr(client_options, name, None)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _resolve_universe_domain(client_options) -> str:
|
|
38
|
+
"""Resolves the universe domain with the helper the generated client uses."""
|
|
39
|
+
return get_universe_domain(
|
|
40
|
+
_get_option(client_options, "universe_domain"),
|
|
41
|
+
os.getenv("GOOGLE_CLOUD_UNIVERSE_DOMAIN"),
|
|
42
|
+
default_universe=_DEFAULT_UNIVERSE_DOMAIN,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _resolve_grpc_config(client_options, attempt_direct_path):
|
|
47
|
+
"""Resolves universe domain, target host, quota project, and DirectPath flag.
|
|
48
|
+
|
|
49
|
+
DirectPath is only attempted in the default universe.
|
|
50
|
+
"""
|
|
51
|
+
universe_domain = _resolve_universe_domain(client_options)
|
|
52
|
+
if universe_domain.lower() != _DEFAULT_UNIVERSE_DOMAIN.lower():
|
|
53
|
+
attempt_direct_path = False
|
|
54
|
+
|
|
55
|
+
host = _get_option(client_options, "api_endpoint") or f"storage.{universe_domain}"
|
|
56
|
+
return (
|
|
57
|
+
universe_domain,
|
|
58
|
+
host,
|
|
59
|
+
_get_option(client_options, "quota_project_id"),
|
|
60
|
+
attempt_direct_path,
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _is_mock_object(value) -> bool:
|
|
65
|
+
"""Returns True when ``value`` is a ``unittest.mock`` object."""
|
|
66
|
+
return any(cls.__module__ == "unittest.mock" for cls in type(value).__mro__)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _validate_universe_domain(universe_domain: str, credentials) -> None:
|
|
70
|
+
"""Raises UniverseMismatchError unless the credentials belong to ``universe_domain``.
|
|
71
|
+
|
|
72
|
+
Credentials that do not expose a universe domain are treated as
|
|
73
|
+
``googleapis.com``, so they are rejected in any other universe.
|
|
74
|
+
Unconfigured ``unittest.mock`` credentials are skipped so caller unit tests
|
|
75
|
+
using ``mock.Mock()`` continue to work.
|
|
76
|
+
"""
|
|
77
|
+
if credentials is not None and not isinstance(
|
|
78
|
+
credentials, auth_credentials.AnonymousCredentials
|
|
79
|
+
):
|
|
80
|
+
creds_universe = getattr(credentials, "universe_domain", None)
|
|
81
|
+
if _is_mock_object(creds_universe):
|
|
82
|
+
return
|
|
83
|
+
universe.compare_domains(universe_domain, credentials)
|
|
22
84
|
|
|
23
85
|
|
|
24
86
|
class GrpcClient(ClientWithProject):
|
|
@@ -80,13 +142,24 @@ class GrpcClient(ClientWithProject):
|
|
|
80
142
|
elif api_key:
|
|
81
143
|
client_options.api_key = api_key
|
|
82
144
|
|
|
145
|
+
effective_credentials = (
|
|
146
|
+
credentials
|
|
147
|
+
if credentials is not None
|
|
148
|
+
else getattr(self, "_credentials", None)
|
|
149
|
+
)
|
|
150
|
+
self._universe_domain = _resolve_universe_domain(client_options)
|
|
83
151
|
self._grpc_client = self._create_gapic_client(
|
|
84
|
-
credentials=
|
|
152
|
+
credentials=effective_credentials,
|
|
85
153
|
client_info=client_info,
|
|
86
154
|
client_options=client_options,
|
|
87
155
|
attempt_direct_path=attempt_direct_path,
|
|
88
156
|
)
|
|
89
157
|
|
|
158
|
+
@property
|
|
159
|
+
def universe_domain(self) -> str:
|
|
160
|
+
"""The universe domain used by the client instance."""
|
|
161
|
+
return self._universe_domain
|
|
162
|
+
|
|
90
163
|
def _create_gapic_client(
|
|
91
164
|
self,
|
|
92
165
|
credentials=None,
|
|
@@ -95,14 +168,27 @@ class GrpcClient(ClientWithProject):
|
|
|
95
168
|
attempt_direct_path=True,
|
|
96
169
|
):
|
|
97
170
|
"""Creates and configures the low-level GAPIC `storage_v2` client."""
|
|
98
|
-
|
|
171
|
+
(
|
|
172
|
+
universe_domain,
|
|
173
|
+
host,
|
|
174
|
+
quota_project_id,
|
|
175
|
+
attempt_direct_path,
|
|
176
|
+
) = _resolve_grpc_config(client_options, attempt_direct_path)
|
|
177
|
+
_validate_universe_domain(universe_domain, credentials)
|
|
99
178
|
|
|
100
|
-
|
|
179
|
+
transport_cls = storage_v2.StorageClient.get_transport_class("grpc")
|
|
180
|
+
channel_kwargs = {
|
|
181
|
+
"host": host,
|
|
182
|
+
"credentials": credentials,
|
|
183
|
+
"attempt_direct_path": attempt_direct_path,
|
|
184
|
+
}
|
|
185
|
+
if quota_project_id is not None:
|
|
186
|
+
channel_kwargs["quota_project_id"] = quota_project_id
|
|
101
187
|
|
|
102
|
-
|
|
188
|
+
channel = transport_cls.create_channel(**channel_kwargs)
|
|
189
|
+
transport = transport_cls(host=host, channel=channel)
|
|
103
190
|
|
|
104
191
|
return storage_v2.StorageClient(
|
|
105
|
-
credentials=credentials,
|
|
106
192
|
transport=transport,
|
|
107
193
|
client_info=client_info,
|
|
108
194
|
client_options=client_options,
|
|
@@ -24,10 +24,16 @@ from google.cloud.storage import __version__
|
|
|
24
24
|
from google.cloud.storage.asyncio import async_grpc_client
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
@pytest.fixture(autouse=True)
|
|
28
|
+
def _hermetic_env(monkeypatch):
|
|
29
|
+
"""Keeps the runner's environment from changing host or DirectPath resolution."""
|
|
30
|
+
monkeypatch.delenv("GOOGLE_CLOUD_UNIVERSE_DOMAIN", raising=False)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _make_credentials():
|
|
34
|
+
return mock.Mock(
|
|
35
|
+
spec=auth_credentials.Credentials, universe_domain="googleapis.com"
|
|
36
|
+
)
|
|
31
37
|
|
|
32
38
|
|
|
33
39
|
class TestAsyncGrpcClient:
|
|
@@ -60,7 +66,9 @@ class TestAsyncGrpcClient:
|
|
|
60
66
|
options=expected_options,
|
|
61
67
|
)
|
|
62
68
|
mock_channel = mock_transport_cls.create_channel.return_value
|
|
63
|
-
mock_transport_cls.assert_called_once_with(
|
|
69
|
+
mock_transport_cls.assert_called_once_with(
|
|
70
|
+
host="storage.googleapis.com", channel=mock_channel
|
|
71
|
+
)
|
|
64
72
|
mock_transport = mock_transport_cls.return_value
|
|
65
73
|
assert kwargs["transport"] is mock_transport
|
|
66
74
|
assert kwargs["client_options"] is None
|
|
@@ -147,7 +155,9 @@ class TestAsyncGrpcClient:
|
|
|
147
155
|
options=expected_options,
|
|
148
156
|
)
|
|
149
157
|
mock_channel = mock_transport_cls.create_channel.return_value
|
|
150
|
-
mock_transport_cls.assert_called_once_with(
|
|
158
|
+
mock_transport_cls.assert_called_once_with(
|
|
159
|
+
host="storage.googleapis.com", channel=mock_channel
|
|
160
|
+
)
|
|
151
161
|
|
|
152
162
|
@mock.patch("google.cloud._storage_v2.StorageAsyncClient")
|
|
153
163
|
def test_grpc_client_property(self, mock_grpc_gapic_client):
|
|
@@ -190,7 +200,9 @@ class TestAsyncGrpcClient:
|
|
|
190
200
|
credentials=mock_creds,
|
|
191
201
|
options=expected_options,
|
|
192
202
|
)
|
|
193
|
-
mock_transport_cls.assert_called_once_with(
|
|
203
|
+
mock_transport_cls.assert_called_once_with(
|
|
204
|
+
host="storage.googleapis.com", channel=channel_sentinel
|
|
205
|
+
)
|
|
194
206
|
mock_grpc_gapic_client.assert_called_once_with(
|
|
195
207
|
transport=mock_transport_instance,
|
|
196
208
|
client_info=client_info,
|
|
@@ -431,3 +443,186 @@ class TestAsyncGrpcClient:
|
|
|
431
443
|
client = async_grpc_client.AsyncGrpcClient(credentials=_make_credentials())
|
|
432
444
|
with pytest.raises(expected_exc):
|
|
433
445
|
await client.get_object("bucket", "object", metadata=invalid_metadata)
|
|
446
|
+
|
|
447
|
+
@pytest.mark.parametrize(
|
|
448
|
+
"env,opts,expected_host",
|
|
449
|
+
[
|
|
450
|
+
(
|
|
451
|
+
{},
|
|
452
|
+
{"universe_domain": "example.com"},
|
|
453
|
+
"storage.example.com",
|
|
454
|
+
),
|
|
455
|
+
(
|
|
456
|
+
{"GOOGLE_CLOUD_UNIVERSE_DOMAIN": "example.com"},
|
|
457
|
+
None,
|
|
458
|
+
"storage.example.com",
|
|
459
|
+
),
|
|
460
|
+
(
|
|
461
|
+
{},
|
|
462
|
+
client_options.ClientOptions(
|
|
463
|
+
universe_domain="example.com", api_endpoint="custom.example.com:443"
|
|
464
|
+
),
|
|
465
|
+
"custom.example.com:443",
|
|
466
|
+
),
|
|
467
|
+
],
|
|
468
|
+
)
|
|
469
|
+
@mock.patch("google.cloud._storage_v2.StorageAsyncClient")
|
|
470
|
+
def test_universe_domain_routing_and_direct_path_disabled(
|
|
471
|
+
self, mock_async_storage_client, env, opts, expected_host
|
|
472
|
+
):
|
|
473
|
+
mock_transport_cls = mock.MagicMock()
|
|
474
|
+
mock_async_storage_client.get_transport_class.return_value = mock_transport_cls
|
|
475
|
+
mock_creds = _make_credentials()
|
|
476
|
+
mock_creds.universe_domain = "example.com"
|
|
477
|
+
|
|
478
|
+
with mock.patch.dict("os.environ", env):
|
|
479
|
+
client = async_grpc_client.AsyncGrpcClient(
|
|
480
|
+
credentials=mock_creds,
|
|
481
|
+
client_options=opts,
|
|
482
|
+
attempt_direct_path=True,
|
|
483
|
+
)
|
|
484
|
+
|
|
485
|
+
assert client.universe_domain == "example.com"
|
|
486
|
+
primary_ua = mock_async_storage_client.call_args.kwargs[
|
|
487
|
+
"client_info"
|
|
488
|
+
].to_user_agent()
|
|
489
|
+
mock_transport_cls.create_channel.assert_called_once_with(
|
|
490
|
+
host=expected_host,
|
|
491
|
+
quota_project_id=None,
|
|
492
|
+
attempt_direct_path=False,
|
|
493
|
+
credentials=mock_creds,
|
|
494
|
+
options=(("grpc.primary_user_agent", primary_ua),),
|
|
495
|
+
)
|
|
496
|
+
mock_transport_cls.assert_called_once_with(
|
|
497
|
+
host=expected_host,
|
|
498
|
+
channel=mock_transport_cls.create_channel.return_value,
|
|
499
|
+
)
|
|
500
|
+
|
|
501
|
+
@mock.patch("google.cloud._storage_v2.StorageAsyncClient")
|
|
502
|
+
def test_empty_universe_domain_error(self, mock_async_storage_client):
|
|
503
|
+
mock_transport_cls = mock.MagicMock()
|
|
504
|
+
mock_async_storage_client.get_transport_class.return_value = mock_transport_cls
|
|
505
|
+
|
|
506
|
+
with pytest.raises(
|
|
507
|
+
ValueError, match="Universe Domain cannot be an empty string"
|
|
508
|
+
):
|
|
509
|
+
async_grpc_client.AsyncGrpcClient(
|
|
510
|
+
credentials=_make_credentials(),
|
|
511
|
+
client_options=client_options.ClientOptions(universe_domain=""),
|
|
512
|
+
)
|
|
513
|
+
mock_transport_cls.create_channel.assert_not_called()
|
|
514
|
+
|
|
515
|
+
@mock.patch("google.auth.default")
|
|
516
|
+
@mock.patch("google.cloud._storage_v2.StorageAsyncClient")
|
|
517
|
+
def test_universe_domain_validation_errors(
|
|
518
|
+
self, mock_async_storage_client, mock_auth_default
|
|
519
|
+
):
|
|
520
|
+
mock_transport_cls = mock.MagicMock()
|
|
521
|
+
mock_async_storage_client.get_transport_class.return_value = mock_transport_cls
|
|
522
|
+
other_creds = _make_credentials()
|
|
523
|
+
other_creds.universe_domain = "example.com"
|
|
524
|
+
mock_auth_default.return_value = (other_creds, "test-project")
|
|
525
|
+
|
|
526
|
+
with pytest.raises(ValueError, match="example.com"):
|
|
527
|
+
async_grpc_client.AsyncGrpcClient(credentials=other_creds)
|
|
528
|
+
with pytest.raises(ValueError, match="example.com"):
|
|
529
|
+
async_grpc_client.AsyncGrpcClient()
|
|
530
|
+
mock_transport_cls.create_channel.assert_not_called()
|
|
531
|
+
|
|
532
|
+
@pytest.mark.parametrize("creds_universe", ["__missing__", None, 123])
|
|
533
|
+
@mock.patch("google.cloud._storage_v2.StorageAsyncClient")
|
|
534
|
+
def test_universe_domain_validation_unusable_creds(
|
|
535
|
+
self, mock_async_storage_client, creds_universe
|
|
536
|
+
):
|
|
537
|
+
mock_transport_cls = mock.MagicMock()
|
|
538
|
+
mock_async_storage_client.get_transport_class.return_value = mock_transport_cls
|
|
539
|
+
creds = _make_credentials()
|
|
540
|
+
if creds_universe == "__missing__":
|
|
541
|
+
del creds.universe_domain
|
|
542
|
+
else:
|
|
543
|
+
creds.universe_domain = creds_universe
|
|
544
|
+
|
|
545
|
+
with pytest.raises(ValueError, match="does not match"):
|
|
546
|
+
async_grpc_client.AsyncGrpcClient(
|
|
547
|
+
credentials=creds,
|
|
548
|
+
client_options={"universe_domain": "example.com"},
|
|
549
|
+
)
|
|
550
|
+
mock_transport_cls.create_channel.assert_not_called()
|
|
551
|
+
|
|
552
|
+
@pytest.mark.parametrize(
|
|
553
|
+
"creds_factory",
|
|
554
|
+
[mock.Mock, lambda: mock.Mock(spec=auth_credentials.Credentials)],
|
|
555
|
+
)
|
|
556
|
+
@mock.patch("google.cloud._storage_v2.StorageAsyncClient")
|
|
557
|
+
def test_unconfigured_mock_credentials_allowed(
|
|
558
|
+
self, mock_async_storage_client, creds_factory
|
|
559
|
+
):
|
|
560
|
+
mock_transport_cls = mock.MagicMock()
|
|
561
|
+
mock_async_storage_client.get_transport_class.return_value = mock_transport_cls
|
|
562
|
+
mock_creds = creds_factory()
|
|
563
|
+
|
|
564
|
+
client = async_grpc_client.AsyncGrpcClient(credentials=mock_creds)
|
|
565
|
+
|
|
566
|
+
assert client.universe_domain == "googleapis.com"
|
|
567
|
+
primary_ua = mock_async_storage_client.call_args.kwargs[
|
|
568
|
+
"client_info"
|
|
569
|
+
].to_user_agent()
|
|
570
|
+
mock_transport_cls.create_channel.assert_called_once_with(
|
|
571
|
+
host="storage.googleapis.com",
|
|
572
|
+
quota_project_id=None,
|
|
573
|
+
attempt_direct_path=True,
|
|
574
|
+
credentials=mock_creds,
|
|
575
|
+
options=(("grpc.primary_user_agent", primary_ua),),
|
|
576
|
+
)
|
|
577
|
+
|
|
578
|
+
@pytest.mark.parametrize(
|
|
579
|
+
"env,universe_opt,expected",
|
|
580
|
+
[
|
|
581
|
+
({}, "example.com", "example.com"),
|
|
582
|
+
({"GOOGLE_CLOUD_UNIVERSE_DOMAIN": "example.com"}, None, "example.com"),
|
|
583
|
+
({}, None, "googleapis.com"),
|
|
584
|
+
],
|
|
585
|
+
)
|
|
586
|
+
@mock.patch("google.cloud._storage_v2.StorageAsyncClient")
|
|
587
|
+
@mock.patch(
|
|
588
|
+
"google.cloud.storage.asyncio.async_grpc_client.grpc.aio.insecure_channel"
|
|
589
|
+
)
|
|
590
|
+
def test_anonymous_credentials_universe_domain(
|
|
591
|
+
self,
|
|
592
|
+
mock_insecure_channel,
|
|
593
|
+
mock_async_storage_client,
|
|
594
|
+
env,
|
|
595
|
+
universe_opt,
|
|
596
|
+
expected,
|
|
597
|
+
):
|
|
598
|
+
with mock.patch.dict("os.environ", env):
|
|
599
|
+
client = async_grpc_client.AsyncGrpcClient(
|
|
600
|
+
client_options=client_options.ClientOptions(
|
|
601
|
+
api_endpoint="localhost:8888", universe_domain=universe_opt
|
|
602
|
+
),
|
|
603
|
+
credentials=AnonymousCredentials(),
|
|
604
|
+
)
|
|
605
|
+
|
|
606
|
+
assert client.universe_domain == expected
|
|
607
|
+
mock_insecure_channel.assert_called_once_with("localhost:8888")
|
|
608
|
+
|
|
609
|
+
@mock.patch("google.api_core.grpc_helpers_async.create_channel")
|
|
610
|
+
def test_real_gapic_client_integration_non_default_universe(
|
|
611
|
+
self, mock_create_channel
|
|
612
|
+
):
|
|
613
|
+
import grpc.aio
|
|
614
|
+
|
|
615
|
+
mock_channel = mock.MagicMock(spec=grpc.aio.Channel)
|
|
616
|
+
mock_channel._unary_unary_interceptors = []
|
|
617
|
+
mock_create_channel.return_value = mock_channel
|
|
618
|
+
mock_creds = _make_credentials()
|
|
619
|
+
mock_creds.universe_domain = "example.com"
|
|
620
|
+
client = async_grpc_client.AsyncGrpcClient(
|
|
621
|
+
credentials=mock_creds,
|
|
622
|
+
client_options=client_options.ClientOptions(universe_domain="example.com"),
|
|
623
|
+
)
|
|
624
|
+
assert client.universe_domain == "example.com"
|
|
625
|
+
assert client.grpc_client.universe_domain == "example.com"
|
|
626
|
+
assert client.grpc_client.api_endpoint == "storage.example.com:443"
|
|
627
|
+
assert mock_create_channel.call_args.args[0] == "storage.example.com"
|
|
628
|
+
assert mock_create_channel.call_args.kwargs["attempt_direct_path"] is False
|