code: def test_renew_from_kt(
      self,
      mock_subprocess,
      mock_sleep,
      kerberos_config,
      expected_cmd,
      caplog,
  ):
      expected_cmd_text = " ".join(shlex.quote(f) for f in expected_cmd)
  
      with conf_vars(kerberos_config), caplog.at_level(
          logging.INFO, logger=kerberos.log.name
      ):
          caplog.clear()
          mock_subprocess.Popen.return_value.__enter__.return_value.returncode = (
              0
          )
          mock_subprocess.call.return_value = 0
          renew_from_kt(principal="test-principal", keytab="keytab")
  
      assert caplog.messages == [
          f"Re-initialising kerberos from keytab: {expected_cmd_text}",
          "Renewing kerberos ticket to work around kerberos 1.8.1: kinit -c /tmp/airflow_krb5_ccache -R",
      ]
  
      assert mock_subprocess.Popen.call_args.args[0] == expected_cmd
      assert mock_subprocess.mock_calls == [
          mock.call.Popen(
              expected_cmd,
              bufsize=-1,
              close_fds=True,
              stderr=mock_subprocess.PIPE,
              stdout=mock_subprocess.PIPE,
              universal_newlines=True,
          ),
          mock.call.Popen().__enter__(),
          mock.call.Popen().__enter__().wait(),
          mock.call.Popen().__exit__(None, None, None),
          mock.call.call(
              ["kinit", "-c", "/tmp/airflow_krb5_ccache", "-R"],
              close_fds=True,
          ),
      ]
  
file_path: airflow/tests/security/test_kerberos.py
imports: from __future__ import annotations
  import logging
  import shlex
  from unittest import mock
  import pytest
  from airflow.security import kerberos
  from airflow.security.kerberos import get_kerberos_principle, renew_from_kt
  from tests.test_utils.config import conf_vars
label_desc: Use image node_id 1 for calling the TestKerberos obj's underlying member method code with example usage: obj.test_renew_from_kt(mock_subprocess, mock_sleep, kerberos_config, expected_cmd, caplog) without return types