code: def test_response_error_codes_allowlist(
      self, mock_session_send, create_task_of_operator
  ):
      allowed_error_response_gen = iter(
          [
              (503, "Service Unavailable"),
              (503, "Service Unavailable"),
              (503, "Service Unavailable"),
              (404, "Not Found"),
              (499, "Allowed Non-standard Error Code"),
          ]
      )
  
      def mocking_allowed_error_responses(*_, **__):
          try:
              error_code, error_reason = next(
                  allowed_error_response_gen
              )
          except StopIteration:
              return mock.DEFAULT
  
          error_response = requests.Response()
          error_response.status_code = error_code
          error_response.reason = error_reason
  
          return error_response
  
      def resp_check(_):
          return True
  
      final_response = requests.Response()
      final_response.status_code = 500
      final_response.reason = "Internal Server Error"
  
      mock_session_send.side_effect = mocking_allowed_error_responses
      mock_session_send.return_value = final_response
  
      task = create_task_of_operator(
          HttpSensor,
          dag_id="http_sensor_response_error_codes_allowlist",
          task_id="http_sensor_response_error_codes_allowlist",
          response_error_codes_allowlist=["404", "499", "503"],
          http_conn_id="http_default",
          endpoint="",
          request_params={},
          method="GET",
          response_check=resp_check,
          timeout=5,
          poke_interval=1,
      )
      with pytest.raises(
          AirflowException, match="500:Internal Server Error"
      ):
          task.execute(context={})
  
imports: from __future__ import annotations
  from unittest import mock
  from unittest.mock import patch
  import pytest
  import requests
  from airflow.exceptions import AirflowException, AirflowSensorTimeout, AirflowSkipException
  from airflow.models.dag import DAG
  from airflow.providers.http.operators.http import HttpOperator
  from airflow.providers.http.sensors.http import HttpSensor
  from airflow.utils.timezone import datetime
label_desc: Use image node_id 7 for calling the TestHttpSensor obj's underlying member method code with example usage: obj.test_response_error_codes_allowlist(mock_session_send, create_task_of_operator) and returns: error_response, True, mock