code: def test_get_conn_authorize_using_instance_metadata(
      self,
      mock_ssh_client,
      mock_paramiko,
      mock_os_login_hook,
      mock_compute_hook,
  ):
      mock_paramiko.SSHException = Exception
      mock_paramiko.RSAKey.generate.return_value.get_name.return_value = (
          "NAME"
      )
      mock_paramiko.RSAKey.generate.return_value.get_base64.return_value = (
          "AYZ"
      )
  
      mock_compute_hook.return_value.project_id = TEST_PROJECT_ID
      mock_compute_hook.return_value.get_instance_address.return_value = (
          EXTERNAL_IP
      )
  
      mock_compute_hook.return_value.get_instance_info.return_value = {
          "metadata": {}
      }
  
      hook = ComputeEngineSSHHook(
          instance_name=TEST_INSTANCE_NAME,
          zone=TEST_ZONE,
          use_oslogin=False,
      )
      result = hook.get_conn()
      assert mock_ssh_client.return_value == result
  
      mock_paramiko.RSAKey.generate.assert_called_once_with(2048)
      mock_compute_hook.assert_has_calls(
          [
              mock.call(gcp_conn_id="google_cloud_default"),
              mock.call().get_instance_address(
                  project_id=TEST_PROJECT_ID,
                  resource_id=TEST_INSTANCE_NAME,
                  use_internal_ip=False,
                  zone=TEST_ZONE,
              ),
              mock.call().get_instance_info(
                  project_id=TEST_PROJECT_ID,
                  resource_id=TEST_INSTANCE_NAME,
                  zone=TEST_ZONE,
              ),
              mock.call().set_instance_metadata(
                  metadata={
                      "items": [
                          {
                              "key": "ssh-keys",
                              "value": f"{TEST_PUB_KEY}\n",
                          }
                      ]
                  },
                  project_id=TEST_PROJECT_ID,
                  resource_id=TEST_INSTANCE_NAME,
                  zone=TEST_ZONE,
              ),
          ]
      )
  
      mock_ssh_client.assert_has_calls(
          [
              mock.call(mock_compute_hook.return_value),
              mock.call().set_missing_host_key_policy(
                  mock_paramiko.AutoAddPolicy.return_value
              ),
              mock.call().connect(
                  hostname=EXTERNAL_IP,
                  look_for_keys=False,
                  pkey=mock_paramiko.RSAKey.generate.return_value,
                  sock=None,
                  username="root",
              ),
          ]
      )
  
      mock_os_login_hook.return_value.import_ssh_public_key.assert_not_called()
  
imports: from __future__ import annotations
  import json
  import logging
  from unittest import mock
  import httplib2
  import pytest
  from googleapiclient.errors import HttpError
  from paramiko.ssh_exception import SSHException
  from airflow.exceptions import AirflowException
  from airflow.models import Connection
  from airflow.providers.google.cloud.hooks.compute_ssh import ComputeEngineSSHHook
label_desc: Use image node_id 4 for calling the TestComputeEngineHookWithPassedProjectId obj's underlying member method code with example usage: obj.test_get_conn_authorize_using_instance_metadata(mock_ssh_client, mock_paramiko, mock_os_login_hook, mock_compute_hook) without return types