code: def test_run_command_daemon(
      self, mock_krb, mock_daemon, mock_setup_locations, mock_pid_file
  ):
      mock_setup_locations.return_value = (
          mock.MagicMock(name="pidfile"),
          mock.MagicMock(name="stdout"),
          mock.MagicMock(name="stderr"),
          mock.MagicMock(name="INVALID"),
      )
      args = self.parser.parse_args(
          [
              "kerberos",
              "PRINCIPAL",
              "--keytab",
              "/tmp/airflow.keytab",
              "--log-file",
              "/tmp/kerberos.log",
              "--pid",
              "/tmp/kerberos.pid",
              "--stderr",
              "/tmp/kerberos-stderr.log",
              "--stdout",
              "/tmp/kerberos-stdout.log",
              "--daemon",
          ]
      )
      mock_open = mock.mock_open()
      with mock.patch(
          "airflow.cli.commands.daemon_utils.open", mock_open
      ):
          kerberos_command.kerberos(args)
  
      mock_krb.run.assert_called_once_with(
          keytab="/tmp/airflow.keytab",
          principal="PRINCIPAL",
          mode=KerberosMode.STANDARD,
      )
      assert mock_daemon.mock_calls[:3] == [
          mock.call.DaemonContext(
              pidfile=mock_pid_file.return_value,
              files_preserve=None,
              stderr=mock_open.return_value,
              stdout=mock_open.return_value,
              umask=0o077,
          ),
          mock.call.DaemonContext().__enter__(),
          mock.call.DaemonContext().__exit__(None, None, None),
      ]
  
      assert mock_setup_locations.mock_calls[0] == mock.call(
          process="kerberos",
          stdout="/tmp/kerberos-stdout.log",
          stderr="/tmp/kerberos-stderr.log",
          log="/tmp/kerberos.log",
      )
  
      mock_pid_file.mock_calls[0] = mock.call(
          mock_setup_locations.return_value[0], -1
      )
      assert mock_open.mock_calls == [
          mock.call(mock_setup_locations.return_value[1], "a"),
          mock.call().__enter__(),
          mock.call(mock_setup_locations.return_value[2], "a"),
          mock.call().__enter__(),
          mock.call().truncate(0),
          mock.call().truncate(0),
          mock.call().__exit__(None, None, None),
          mock.call().__exit__(None, None, None),
      ]
  
file_path: airflow/tests/cli/commands/test_kerberos_command.py
imports: from __future__ import annotations
  from unittest import mock
  import pytest
  from airflow.cli import cli_parser
  from airflow.cli.commands import kerberos_command
  from airflow.security.kerberos import KerberosMode
  from tests.test_utils.config import conf_vars
label_desc: Use image node_id 3 for calling the TestKerberosCommand obj's underlying member method code with example usage: obj.test_run_command_daemon(mock_krb, mock_daemon, mock_setup_locations, mock_pid_file) without return types