code: def test_log_artifact(
      dbfs_artifact_repo, test_file, artifact_path, expected_endpoint
  ):
      with mock.patch(
          "mlflow.utils.rest_utils.http_request"
      ) as http_request_mock, mock.patch(
          "requests.Session.request", return_value=MOCK_SUCCESS_RESPONSE
      ) as mock_base_request:
          endpoints = []
          data = []
  
          def my_http_request(
              host_creds, **kwargs
          ):  # pylint: disable=unused-argument
              endpoints.append(kwargs["endpoint"])
              data.append(kwargs["data"].read())
              return http_request(host_creds, **kwargs)
  
          http_request_mock.side_effect = my_http_request
          dbfs_artifact_repo.log_artifact(test_file, artifact_path)
          assert endpoints == [expected_endpoint]
          assert data == [TEST_FILE_1_CONTENT]
          mock_base_request.assert_called_once_with(
              "POST",
              f"http://host{expected_endpoint}",
              **MOCK_REQUEST_KWARGS,
          )
  
imports: import json
  import os
  from unittest import mock
  from unittest.mock import Mock
  import pytest
  from mlflow.exceptions import MlflowException
  from mlflow.store.artifact.artifact_repository_registry import get_artifact_repository
  from mlflow.store.artifact.dbfs_artifact_repo import DbfsRestArtifactRepository, _get_host_creds_from_default_store
  from mlflow.store.tracking.file_store import FileStore
  from mlflow.store.tracking.rest_store import RestStore
  from mlflow.utils.rest_utils import MlflowHostCreds, http_request
label_desc: Use image node_id 6 for calling a global function with example usage: test_log_artifact(dbfs_artifact_repo, test_file, artifact_path, expected_endpoint) and returns: http_request