code: def test_main_analytics(mocker, tmp_dir, dvc):
      mock_is_enabled = mocker.patch(
          "dvc.analytics.collect_and_send_report"
      )
      mock_report = mocker.patch(
          "dvc.analytics.is_enabled", return_value=True
      )
      tmp_dir.gen("foo", "text")
      assert main(["add", "foo"]) == 0
      assert mock_is_enabled.called
      assert mock_report.called
  
file_path: dvc/tests/func/test_analytics.py
imports: import os
  import pytest
  from dvc.analytics import _scm_in_use, collect_and_send_report
  from dvc.cli import main
  from dvc.repo import Repo
  from tests.utils import ANY
label_desc: Use image node_id 2 for calling a global function with example usage: test_main_analytics(mocker, tmp_dir, dvc) without return types