code: def test_authenticate(client, monkeypatch):
      # unauthenticated
      monkeypatch.delenvs(
          [
              MLFLOW_TRACKING_USERNAME.name,
              MLFLOW_TRACKING_PASSWORD.name,
          ],
          raising=False,
      )
      with pytest.raises(
          MlflowException, match=r"You are not authenticated."
      ) as exception_context:
          client.search_experiments()
      assert exception_context.value.error_code == ErrorCode.Name(
          UNAUTHENTICATED
      )
  
      # authenticated
      username, password = create_user(client.tracking_uri)
      with User(username, password, monkeypatch):
          client.search_experiments()
  
imports: import subprocess
  import sys
  import time
  from pathlib import Path
  import jwt
  import psutil
  import pytest
  import requests
  import mlflow
  from mlflow import MlflowClient
  from mlflow.environment_variables import MLFLOW_TRACKING_PASSWORD, MLFLOW_TRACKING_USERNAME
  from mlflow.exceptions import MlflowException
  from mlflow.protos.databricks_pb2 import UNAUTHENTICATED, ErrorCode
  from mlflow.utils.os import is_windows
  from tests.helper_functions import random_str
  from tests.server.auth.auth_test_utils import ADMIN_USERNAME, User, create_user
  from tests.tracking.integration_test_utils import _init_server, _send_rest_tracking_post_request, get_safe_port
label_desc: Use image node_id 2 for calling a global function with example usage: test_authenticate(client, monkeypatch) without return types