code: def test_collect_and_send_report(mocker, tmp_global_dir):
      mock_json = mocker.patch("json.dump")
      mock_daemon = mocker.patch("dvc.daemon._spawn")
      analytics.collect_and_send_report()
      report = mock_json.call_args[0][0]
  
      assert not report.get("cmd_class")
      assert not report.get("cmd_return_code")
  
      args = parse_args(["add", "foo"])
      return_code = 0
  
      analytics.collect_and_send_report(args, return_code)
      report = mock_json.call_args[0][0]
  
      assert report["cmd_class"] == "CmdAdd"
      assert report["cmd_return_code"] == return_code
  
      assert mock_daemon.call_count == 2
  
file_path: dvc/tests/unit/test_analytics.py
imports: import json
  import platform
  import pytest
  from voluptuous import Any, Schema
  from dvc import analytics
  from dvc.cli import parse_args
label_desc: Use image node_id 2 for calling a global function with example usage: test_collect_and_send_report(mocker, tmp_global_dir) without return types