code: def test_enclave_connect_to_gateway(faker: Faker):
      gateway_node_handle = get_node_handle(NodeType.GATEWAY.value)
      gateway_client = gateway_node_handle.client
      enclave_client: EnclaveClient = get_node_handle(
          NodeType.ENCLAVE.value
      ).client
  
      result = enclave_client.connect_to_gateway(
          handle=gateway_node_handle
      )
      assert isinstance(result, SyftSuccess)
  
      # Try via client approach
      result_2 = enclave_client.connect_to_gateway(
          via_client=gateway_node_handle.client
      )
      assert isinstance(result_2, SyftSuccess)
  
      assert len(enclave_client.peers) == 1
      assert len(gateway_client.peers) == 1
  
      proxy_enclave_client = gateway_client.peers[0]
      enclave_peer = enclave_client.peers[0]
  
      assert isinstance(proxy_enclave_client, EnclaveClient)
      assert isinstance(enclave_peer, NodePeer)
  
      assert gateway_client.name == enclave_peer.name
      assert enclave_client.name == proxy_enclave_client.name
  
      # Domain's peer is a gateway and vice-versa
      assert enclave_peer.node_type == NodeType.GATEWAY
  
      assert len(gateway_client.domains) == 0
      assert len(gateway_client.enclaves) == 1
  
      assert proxy_enclave_client.metadata == enclave_client.metadata
      assert proxy_enclave_client.user_role == ServiceRole.NONE
  
      # add a new user to enclave
      user_email, password = faker.email(), "password"
      enclave_client.register(
          name=faker.name(),
          email=user_email,
          password=password,
          password_verify=password,
      )
  
      enclave_client = enclave_client.login(
          email=user_email, password=password
      )
      proxy_enclave_client = proxy_enclave_client.login(
          email=user_email, password=password
      )
  
      assert proxy_enclave_client.logged_in_user == user_email
      assert proxy_enclave_client.user_role == enclave_client.user_role
      assert (
          proxy_enclave_client.credentials == enclave_client.credentials
      )
      assert (
          proxy_enclave_client.api.endpoints.keys()
          == enclave_client.api.endpoints.keys()
      )
  
file_path: PySyft/packages/syft/tests/syft/gateways/gateway_test.py
imports: from faker import Faker
  from hagrid.orchestra import NodeHandle
  import syft
  from syft.abstract_node import NodeType
  from syft.client.domain_client import DomainClient
  from syft.client.enclave_client import EnclaveClient
  from syft.client.gateway_client import GatewayClient
  from syft.service.network.node_peer import NodePeer
  from syft.service.response import SyftSuccess
  from syft.service.user.user_roles import ServiceRole
label_desc: Use image node_id 6 for calling a global function with example usage: test_enclave_connect_to_gateway(faker) without return types