code: def test_download_artifacts(http_artifact_repo, tmp_path):
      # This test simulates downloading artifacts in the following structure:
      # ---------
      # - a.txt
      # - dir
      #   - b.txt
      # ---------
      def http_request(_host_creds, endpoint, _method, **kwargs):
          # Responses for list_artifacts
          params = kwargs.get("params")
          if params:
              if params.get("path") == "":
                  return MockResponse(
                      {
                          "files": [
                              {
                                  "path": "a.txt",
                                  "is_dir": False,
                                  "file_size": 1,
                              },
                              {"path": "dir", "is_dir": True},
                          ]
                      },
                      200,
                  )
              elif params.get("path") == "dir":
                  return MockResponse(
                      {
                          "files": [
                              {
                                  "path": "b.txt",
                                  "is_dir": False,
                                  "file_size": 1,
                              },
                          ]
                      },
                      200,
                  )
              else:
                  Exception("Unreachable")
  
          # Responses for _download_file
          if endpoint == "/a.txt":
              return MockStreamResponse("data_a", 200)
          elif endpoint == "/dir/b.txt":
              return MockStreamResponse("data_b", 200)
          else:
              raise Exception("Unreachable")
  
      with mock.patch(
          "mlflow.store.artifact.http_artifact_repo.http_request",
          http_request,
      ):
          http_artifact_repo.download_artifacts("", tmp_path)
          paths = [
              os.path.join(root, f)
              for root, _, files in os.walk(tmp_path)
              for f in files
          ]
          assert [os.path.relpath(p, tmp_path) for p in paths] == [
              "a.txt",
              os.path.join("dir", "b.txt"),
          ]
          assert read_file(paths[0]) == "data_a"
          assert read_file(paths[1]) == "data_b"
  
imports: import os
  import posixpath
  from unittest import mock
  import pytest
  from requests import HTTPError
  from mlflow.entities.multipart_upload import CreateMultipartUploadResponse, MultipartUploadCredential, MultipartUploadPart
  from mlflow.environment_variables import MLFLOW_MULTIPART_UPLOAD_MINIMUM_FILE_SIZE, MLFLOW_TRACKING_CLIENT_CERT_PATH, MLFLOW_TRACKING_INSECURE_TLS, MLFLOW_TRACKING_PASSWORD, MLFLOW_TRACKING_SERVER_CERT_PATH, MLFLOW_TRACKING_TOKEN, MLFLOW_TRACKING_USERNAME
  from mlflow.exceptions import MlflowException
  from mlflow.store.artifact.artifact_repository_registry import get_artifact_repository
  from mlflow.store.artifact.http_artifact_repo import HttpArtifactRepository
  from mlflow.tracking._tracking_service.utils import _get_default_host_creds
  from mlflow.utils.rest_utils import MlflowHostCreds
label_desc: Use image node_id 9 for calling a global function with example usage: test_download_artifacts(http_artifact_repo, tmp_path) and returns: MockStreamResponse, MockResponse, MockStreamResponse, MockResponse