code: def test_deploy(sagemaker_session, candidate_mock):
      auto_ml = AutoML(
          role=ROLE,
          target_attribute_name=TARGET_ATTRIBUTE_NAME,
          sagemaker_session=sagemaker_session,
      )
      mock_pipeline = Mock(name="pipeline_model")
      mock_pipeline.deploy = Mock(name="model_deploy")
      auto_ml.best_candidate = Mock(
          name="best_candidate", return_value=CANDIDATE_DICT
      )
      auto_ml.create_model = Mock(
          name="create_model", return_value=mock_pipeline
      )
      auto_ml.deploy(
          initial_instance_count=INSTANCE_COUNT,
          instance_type=INSTANCE_TYPE,
          sagemaker_session=sagemaker_session,
          model_kms_key=OUTPUT_KMS_KEY,
      )
      auto_ml.create_model.assert_called_once()
      mock_pipeline.deploy.assert_called_once()
  
imports: from __future__ import absolute_import
  import copy
  import pytest
  from mock import Mock, patch
  from sagemaker import AutoML, AutoMLJob, AutoMLInput, CandidateEstimator, PipelineModel
  from sagemaker.predictor import Predictor
  from sagemaker.session_settings import SessionSettings
  from sagemaker.workflow.functions import Join
  from tests.unit import SAGEMAKER_CONFIG_AUTO_ML, SAGEMAKER_CONFIG_TRAINING_JOB, _test_default_bucket_and_prefix_combinations, DEFAULT_S3_BUCKET_NAME, DEFAULT_S3_OBJECT_KEY_PREFIX_NAME
label_desc: Use image node_id 24 for calling a global function with example usage: test_deploy(sagemaker_session, candidate_mock) without return types