code: def test_log_artifacts(http_artifact_repo, tmp_path, artifact_path):
      tmp_path_a = tmp_path.joinpath("a.txt")
      d = tmp_path.joinpath("dir")
      d.mkdir()
      tmp_path_b = d.joinpath("b.txt")
      tmp_path_a.write_text("0")
      tmp_path_b.write_text("1")
  
      with mock.patch.object(
          http_artifact_repo, "log_artifact"
      ) as mock_log_artifact:
          http_artifact_repo.log_artifacts(tmp_path, artifact_path)
          mock_log_artifact.assert_has_calls(
              [
                  mock.call(str(tmp_path_a), artifact_path),
                  mock.call(
                      str(tmp_path_b),
                      posixpath.join(artifact_path, "dir")
                      if artifact_path
                      else "dir",
                  ),
              ],
          )
  
      with mock.patch(
          "mlflow.store.artifact.http_artifact_repo.http_request",
          return_value=MockResponse({}, 400),
      ):
          with pytest.raises(Exception, match="request failed"):
              http_artifact_repo.log_artifacts(tmp_path, artifact_path)
  
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 4 for calling a global function with example usage: test_log_artifacts(http_artifact_repo, tmp_path, artifact_path) without return types