code: def test_log_artifact(mlflow_artifact_repo, tmp_path, artifact_path):
      tmp_path = tmp_path.joinpath("a.txt")
      tmp_path.write_text("0")
      with mock.patch(
          "mlflow.store.artifact.http_artifact_repo.http_request",
          return_value=MockResponse({}, 200),
      ) as mock_put:
          mlflow_artifact_repo.log_artifact(tmp_path, artifact_path)
          paths = (
              (artifact_path, tmp_path.name)
              if artifact_path
              else (tmp_path.name,)
          )
          mock_put.assert_called_once_with(
              mlflow_artifact_repo._host_creds,
              posixpath.join("/", *paths),
              "PUT",
              extra_headers={"Content-Type": "text/plain"},
              data=FileObjectMatcher(str(tmp_path), "rb"),
          )
  
      with mock.patch(
          "mlflow.store.artifact.http_artifact_repo.http_request",
          return_value=MockResponse({}, 400),
      ):
          with pytest.raises(Exception, match="request failed"):
              mlflow_artifact_repo.log_artifact(tmp_path, artifact_path)
  
imports: import os
  import posixpath
  from unittest import mock
  import pytest
  from mlflow.exceptions import MlflowException
  from mlflow.store.artifact.artifact_repository_registry import get_artifact_repository
  from mlflow.store.artifact.mlflow_artifacts_repo import MlflowArtifactsRepository
  from mlflow.tracking._tracking_service.utils import _get_default_host_creds
label_desc: Use image node_id 7 for calling a global function with example usage: test_log_artifact(mlflow_artifact_repo, tmp_path, artifact_path) without return types