code: def test_historical_metrics_data(admin_client, session, time_machine):
      resp = admin_client.get(
          "/object/historical_metrics_data?start_date=2023-01-01T00:00&end_date=2023-08-02T00:00",
          follow_redirects=True,
      )
      assert resp.status_code == 200
      assert resp.json == {
          "dag_run_states": {
              "failed": 1,
              "queued": 0,
              "running": 1,
              "success": 1,
          },
          "dag_run_types": {
              "backfill": 0,
              "dataset_triggered": 1,
              "manual": 0,
              "scheduled": 2,
          },
          "task_instance_states": {
              "deferred": 0,
              "failed": 2,
              "no_status": 2,
              "queued": 0,
              "removed": 0,
              "restarting": 0,
              "running": 0,
              "scheduled": 0,
              "shutdown": 0,
              "skipped": 0,
              "success": 2,
              "up_for_reschedule": 0,
              "up_for_retry": 0,
              "upstream_failed": 0,
          },
      }
  
file_path: airflow/tests/www/views/test_views_cluster_activity.py
imports: from __future__ import annotations
  import pendulum
  import pytest
  from airflow.models import DagBag
  from airflow.operators.empty import EmptyOperator
  from airflow.utils.state import DagRunState, TaskInstanceState
  from airflow.utils.types import DagRunType
  from tests.test_utils.db import clear_db_runs
label_desc: Use image node_id 5 for calling a global function with example usage: test_historical_metrics_data(admin_client, session, time_machine) without return types