class_docstr: Tests for SSL connections.
  
  This relies on the --redis-ssl-url for building the client and connecting to the
  appropriate port.
class_docstr_tok: ["Tests","for","SSL","connections",".","This","relies","on","the","--","redis-ssl-url","for","building","the","client","and","connecting","to","the","appropriate","port","."]
code: def create_client(
      self, request: FixtureRequest
  ) -> Callable[..., RedisCluster]:
      ssl_url = request.config.option.redis_ssl_url
      ssl_host, ssl_port = urlparse(ssl_url)[1].split(":")
  
      async def _create_client(
          mocked: bool = True, **kwargs: Any
      ) -> RedisCluster:
          if mocked:
              with mock.patch.object(
                  ClusterNode, "execute_command", autospec=True
              ) as execute_command_mock:
  
                  async def execute_command(self, *args, **kwargs):
                      if args[0] == "INFO":
                          return {"cluster_enabled": True}
                      if args[0] == "CLUSTER SLOTS":
                          return [
                              [
                                  0,
                                  16383,
                                  [ssl_host, ssl_port, "ssl_node"],
                              ]
                          ]
                      if args[0] == "COMMAND":
                          return {
                              "ping": {
                                  "name": "ping",
                                  "arity": -1,
                                  "flags": ["stale", "fast"],
                                  "first_key_pos": 0,
                                  "last_key_pos": 0,
                                  "step_count": 0,
                              }
                          }
                      raise NotImplementedError()
  
                  execute_command_mock.side_effect = execute_command
  
                  rc = await RedisCluster(
                      host=ssl_host, port=ssl_port, **kwargs
                  )
  
              assert len(rc.get_nodes()) == 1
              node = rc.get_default_node()
              assert node.port == int(ssl_port)
              return rc
  
          return await RedisCluster(
              host=ssl_host, port=ssl_port, **kwargs
          )
  
      return _create_client
  
imports: import asyncio
  import binascii
  import datetime
  import warnings
  from typing import Any, Awaitable, Callable, Dict, List, Optional, Type, Union
  from urllib.parse import urlparse
  import pytest
  import pytest_asyncio
  from _pytest.fixtures import FixtureRequest
  from redis._parsers import AsyncCommandsParser
  from redis.asyncio.cluster import ClusterNode, NodesManager, RedisCluster
  from redis.asyncio.connection import Connection, SSLConnection, async_timeout
  from redis.asyncio.retry import Retry
  from redis.backoff import ExponentialBackoff, NoBackoff, default_backoff
  from redis.cluster import PIPELINE_BLOCKED_COMMANDS, PRIMARY, REPLICA, get_node_name
  from redis.crc import REDIS_CLUSTER_HASH_SLOTS, key_slot
  from redis.exceptions import AskError, ClusterDownError, ConnectionError, DataError, MaxConnectionsError, MovedError, NoPermissionError, RedisClusterException, RedisError, ResponseError
  from redis.utils import str_if_bytes
  from tests.conftest import assert_resp_response, is_resp2_connection, skip_if_redis_enterprise, skip_if_server_version_gte, skip_if_server_version_lt, skip_unless_arch_bits
  from ..ssl_utils import get_ssl_filename
  from .compat import aclosing, mock
label_desc: Use image node_id 1 for calling the TestSSL obj's underlying member method code with example usage: obj.create_client(request) and returns: _create_client, unknown, rc, dict, list, dict