code: def test_mlflow_artifacts_rest_apis(artifacts_server, tmp_path):
      default_artifact_root = artifacts_server.default_artifact_root
      artifacts_destination = artifacts_server.artifacts_destination
  
      # Upload artifacts
      file_a = tmp_path.joinpath("a.txt")
      file_a.write_text("0")
      upload_file(file_a, f"{default_artifact_root}/a.txt")
      assert os.path.exists(
          os.path.join(artifacts_destination, "a.txt")
      )
      assert (
          read_file(os.path.join(artifacts_destination, "a.txt")) == "0"
      )
  
      file_b = tmp_path.joinpath("b.txt")
      file_b.write_text("1")
      upload_file(file_b, f"{default_artifact_root}/dir/b.txt")
      assert os.path.join(artifacts_destination, "dir", "b.txt")
      assert (
          read_file(os.path.join(artifacts_destination, "dir", "b.txt"))
          == "1"
      )
  
      # Download artifacts
      local_dir = tmp_path.joinpath("folder")
      local_dir.mkdir()
      local_path_a = local_dir.joinpath("a.txt")
      download_file(f"{default_artifact_root}/a.txt", local_path_a)
      assert read_file(local_path_a) == "0"
  
      local_path_b = local_dir.joinpath("b.txt")
      download_file(f"{default_artifact_root}/dir/b.txt", local_path_b)
      assert read_file(local_path_b) == "1"
  
      # List artifacts
      resp = requests.get(default_artifact_root)
      assert resp.json() == {
          "files": [
              {"path": "a.txt", "is_dir": False, "file_size": 1},
              {"path": "dir", "is_dir": True},
          ]
      }
      resp = requests.get(default_artifact_root, params={"path": "dir"})
      assert resp.json() == {
          "files": [{"path": "b.txt", "is_dir": False, "file_size": 1}]
      }
  
imports: import cgi
  import os
  import pathlib
  import subprocess
  import tempfile
  from collections import namedtuple
  import pytest
  import requests
  import mlflow
  from mlflow import MlflowClient
  from mlflow.artifacts import download_artifacts
  from tests.helper_functions import LOCALHOST, get_safe_port
  from tests.tracking.integration_test_utils import _await_server_up_or_die
label_desc: Use image node_id 7 for calling a global function with example usage: test_mlflow_artifacts_rest_apis(artifacts_server, tmp_path) without return types