# Path: google/cloud/redis_v1/services/cloud_redis/pagers.py
# class ListInstancesPager:
# class ListInstancesAsyncPager:
#     def __init__(
#         self,
#         method: Callable[..., cloud_redis.ListInstancesResponse],
#         request: cloud_redis.ListInstancesRequest,
#         response: cloud_redis.ListInstancesResponse,
#         *,
#         metadata: Sequence[Tuple[str, str]] = ()
#     ):
#     def __getattr__(self, name: str) -> Any:
#     def pages(self) -> Iterator[cloud_redis.ListInstancesResponse]:
#     def __iter__(self) -> Iterator[cloud_redis.Instance]:
#     def __repr__(self) -> str:
#     def __init__(
#         self,
#         method: Callable[..., Awaitable[cloud_redis.ListInstancesResponse]],
#         request: cloud_redis.ListInstancesRequest,
#         response: cloud_redis.ListInstancesResponse,
#         *,
#         metadata: Sequence[Tuple[str, str]] = ()
#     ):
#     def __getattr__(self, name: str) -> Any:
#     async def pages(self) -> AsyncIterator[cloud_redis.ListInstancesResponse]:
#     def __aiter__(self) -> AsyncIterator[cloud_redis.Instance]:
#         async def async_generator():
#     def __repr__(self) -> str:
# 
# Path: google/cloud/redis_v1/types/cloud_redis.py
# class NodeInfo(proto.Message):
# class Instance(proto.Message):
#     class State(proto.Enum):
#     class Tier(proto.Enum):
#     class ConnectMode(proto.Enum):
#     class ReadReplicasMode(proto.Enum):
# class ListInstancesRequest(proto.Message):
# class ListInstancesResponse(proto.Message):
# class GetInstanceRequest(proto.Message):
# class CreateInstanceRequest(proto.Message):
# class UpdateInstanceRequest(proto.Message):
# class UpgradeInstanceRequest(proto.Message):
# class DeleteInstanceRequest(proto.Message):
# class GcsSource(proto.Message):
# class InputConfig(proto.Message):
# class ImportInstanceRequest(proto.Message):
# class GcsDestination(proto.Message):
# class OutputConfig(proto.Message):
# class ExportInstanceRequest(proto.Message):
# class FailoverInstanceRequest(proto.Message):
#     class DataProtectionMode(proto.Enum):
# class OperationMetadata(proto.Message):
# class LocationMetadata(proto.Message):
# class ZoneMetadata(proto.Message):
#         STATE_UNSPECIFIED = 0
#         CREATING = 1
#         READY = 2
#         UPDATING = 3
#         DELETING = 4
#         REPAIRING = 5
#         MAINTENANCE = 6
#         IMPORTING = 8
#         FAILING_OVER = 9
#         TIER_UNSPECIFIED = 0
#         BASIC = 1
#         STANDARD_HA = 3
#         CONNECT_MODE_UNSPECIFIED = 0
#         DIRECT_PEERING = 1
#         PRIVATE_SERVICE_ACCESS = 2
#         READ_REPLICAS_MODE_UNSPECIFIED = 0
#         READ_REPLICAS_DISABLED = 1
#         READ_REPLICAS_ENABLED = 2
#         DATA_PROTECTION_MODE_UNSPECIFIED = 0
#         LIMITED_DATA_LOSS = 1
#         FORCE_DATA_LOSS = 2
#     def raw_page(self):


import os
import mock
import grpc
import math
import pytest
import google.auth
from grpc.experimental import aio
from proto.marshal.rules.dates import DurationRule, TimestampRule
from google.api_core import client_options
from google.api_core import exceptions as core_exceptions
from google.api_core import future
from google.api_core import gapic_v1
from google.api_core import grpc_helpers
from google.api_core import grpc_helpers_async
from google.api_core import operation
from google.api_core import operation_async  # type: ignore
from google.api_core import operations_v1
from google.api_core import path_template
from google.auth import credentials as ga_credentials
from google.auth.exceptions import MutualTLSChannelError
from google.cloud.redis_v1.services.cloud_redis import CloudRedisAsyncClient
from google.cloud.redis_v1.services.cloud_redis import CloudRedisClient
from google.cloud.redis_v1.services.cloud_redis import pagers
from google.cloud.redis_v1.services.cloud_redis import transports
from google.cloud.redis_v1.types import cloud_redis
from google.longrunning import operations_pb2
from google.oauth2 import service_account
from google.protobuf import field_mask_pb2  # type: ignore
from google.protobuf import timestamp_pb2  # type: ignore
                always_use_jwt_access=True,
            )

    # Check the case ADC client cert is provided. Whether client cert is used depends on
    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
    with mock.patch.dict(
        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
    ):
        with mock.patch.object(transport_class, "__init__") as patched:
            with mock.patch(
                "google.auth.transport.mtls.has_default_client_cert_source",
                return_value=True,
            ):
                with mock.patch(
                    "google.auth.transport.mtls.default_client_cert_source",
                    return_value=client_cert_source_callback,
                ):
                    if use_client_cert_env == "false":
                        expected_host = client.DEFAULT_ENDPOINT
                        expected_client_cert_source = None
                    else:
                        expected_host = client.DEFAULT_MTLS_ENDPOINT
                        expected_client_cert_source = client_cert_source_callback

                    patched.return_value = None
                    client = client_class(transport=transport_name)
                    patched.assert_called_once_with(
                        credentials=None,
                        credentials_file=None,
                        host=expected_host,

# Path: google/cloud/redis_v1/services/cloud_redis/pagers.py
# class ListInstancesPager:
# class ListInstancesAsyncPager:
#     def __init__(
#         self,
#         method: Callable[..., cloud_redis.ListInstancesResponse],
#         request: cloud_redis.ListInstancesRequest,
#         response: cloud_redis.ListInstancesResponse,
#         *,
#         metadata: Sequence[Tuple[str, str]] = ()
#     ):
#     def __getattr__(self, name: str) -> Any:
#     def pages(self) -> Iterator[cloud_redis.ListInstancesResponse]:
#     def __iter__(self) -> Iterator[cloud_redis.Instance]:
#     def __repr__(self) -> str:
#     def __init__(
#         self,
#         method: Callable[..., Awaitable[cloud_redis.ListInstancesResponse]],
#         request: cloud_redis.ListInstancesRequest,
#         response: cloud_redis.ListInstancesResponse,
#         *,
#         metadata: Sequence[Tuple[str, str]] = ()
#     ):
#     def __getattr__(self, name: str) -> Any:
#     async def pages(self) -> AsyncIterator[cloud_redis.ListInstancesResponse]:
#     def __aiter__(self) -> AsyncIterator[cloud_redis.Instance]:
#         async def async_generator():
#     def __repr__(self) -> str:
# 
# Path: google/cloud/redis_v1/types/cloud_redis.py
# class NodeInfo(proto.Message):
# class Instance(proto.Message):
#     class State(proto.Enum):
#     class Tier(proto.Enum):
#     class ConnectMode(proto.Enum):
#     class ReadReplicasMode(proto.Enum):
# class ListInstancesRequest(proto.Message):
# class ListInstancesResponse(proto.Message):
# class GetInstanceRequest(proto.Message):
# class CreateInstanceRequest(proto.Message):
# class UpdateInstanceRequest(proto.Message):
# class UpgradeInstanceRequest(proto.Message):
# class DeleteInstanceRequest(proto.Message):
# class GcsSource(proto.Message):
# class InputConfig(proto.Message):
# class ImportInstanceRequest(proto.Message):
# class GcsDestination(proto.Message):
# class OutputConfig(proto.Message):
# class ExportInstanceRequest(proto.Message):
# class FailoverInstanceRequest(proto.Message):
#     class DataProtectionMode(proto.Enum):
# class OperationMetadata(proto.Message):
# class LocationMetadata(proto.Message):
# class ZoneMetadata(proto.Message):
#         STATE_UNSPECIFIED = 0
#         CREATING = 1
#         READY = 2
#         UPDATING = 3
#         DELETING = 4
#         REPAIRING = 5
#         MAINTENANCE = 6
#         IMPORTING = 8
#         FAILING_OVER = 9
#         TIER_UNSPECIFIED = 0
#         BASIC = 1
#         STANDARD_HA = 3
#         CONNECT_MODE_UNSPECIFIED = 0
#         DIRECT_PEERING = 1
#         PRIVATE_SERVICE_ACCESS = 2
#         READ_REPLICAS_MODE_UNSPECIFIED = 0
#         READ_REPLICAS_DISABLED = 1
#         READ_REPLICAS_ENABLED = 2
#         DATA_PROTECTION_MODE_UNSPECIFIED = 0
#         LIMITED_DATA_LOSS = 1
#         FORCE_DATA_LOSS = 2
#     def raw_page(self):


# Path: tests/unit/gapic/redis_v1/test_cloud_redis.py
import os
import mock
import grpc
import math
import pytest
import google.auth
from grpc.experimental import aio
from proto.marshal.rules.dates import DurationRule, TimestampRule
from google.api_core import client_options
from google.api_core import exceptions as core_exceptions
from google.api_core import future
from google.api_core import gapic_v1
from google.api_core import grpc_helpers
from google.api_core import grpc_helpers_async
from google.api_core import operation
from google.api_core import operation_async  # type: ignore
from google.api_core import operations_v1
from google.api_core import path_template
from google.auth import credentials as ga_credentials
from google.auth.exceptions import MutualTLSChannelError
from google.cloud.redis_v1.services.cloud_redis import CloudRedisAsyncClient
from google.cloud.redis_v1.services.cloud_redis import CloudRedisClient
from google.cloud.redis_v1.services.cloud_redis import pagers
from google.cloud.redis_v1.services.cloud_redis import transports
from google.cloud.redis_v1.types import cloud_redis
from google.longrunning import operations_pb2
from google.oauth2 import service_account
from google.protobuf import field_mask_pb2  # type: ignore
from google.protobuf import timestamp_pb2  # type: ignore

                always_use_jwt_access=True,
            )

    # Check the case ADC client cert is provided. Whether client cert is used depends on
    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
    with mock.patch.dict(
        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
    ):
        with mock.patch.object(transport_class, "__init__") as patched:
            with mock.patch(
                "google.auth.transport.mtls.has_default_client_cert_source",
                return_value=True,
            ):
                with mock.patch(
                    "google.auth.transport.mtls.default_client_cert_source",
                    return_value=client_cert_source_callback,
                ):
                    if use_client_cert_env == "false":
                        expected_host = client.DEFAULT_ENDPOINT
                        expected_client_cert_source = None
                    else:
                        expected_host = client.DEFAULT_MTLS_ENDPOINT
                        expected_client_cert_source = client_cert_source_callback

                    patched.return_value = None
                    client = client_class(transport=transport_name)
                    patched.assert_called_once_with(
                        credentials=None,
                        credentials_file=None,
                        host=expected_host,

                        scopes=None,