code: def test_authenticate_jwt(client):
      # unauthenticated
      with pytest.raises(
          requests.HTTPError, match=r"401 Client Error: UNAUTHORIZED"
      ) as e:
          _mlflow_search_experiments_rest(client.tracking_uri, {})
      assert e.value.response.status_code == 401  # Unauthorized
  
      # authenticated
      # we need to use jwt to authenticate as admin so that we can create a new user
      bearer_token = jwt.encode(
          {"username": ADMIN_USERNAME}, "secret", algorithm="HS256"
      )
      headers = {"Authorization": f"Bearer {bearer_token}"}
      username, password = _mlflow_create_user_rest(
          client.tracking_uri, headers
      )
  
      # authenticate with the newly created user
      headers = {
          "Authorization": f'Bearer {jwt.encode({"username": username}, "secret", algorithm="HS256")}'
      }
      _mlflow_search_experiments_rest(client.tracking_uri, headers)
  
      # invalid token
      bearer_token = jwt.encode(
          {"username": username}, "invalid", algorithm="HS256"
      )
      headers = {"Authorization": f"Bearer {bearer_token}"}
      with pytest.raises(
          requests.HTTPError, match=r"401 Client Error: UNAUTHORIZED"
      ) as e:
          _mlflow_search_experiments_rest(client.tracking_uri, headers)
      assert e.value.response.status_code == 401
  
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 5 for calling a global function with example usage: test_authenticate_jwt(client) without return types