Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def execute_complete(self, context: Context, event: dict[str, Any]) -> Any:
)

def process_trigger_event_error(self, event: dict[str, Any]) -> None:
if "error_type" == "timeout":
if event["error_type"] == "timeout":
raise HITLTimeoutError(event)

raise HITLTriggerEventError(event)
Expand Down
24 changes: 24 additions & 0 deletions providers/standard/tests/unit/standard/operators/test_hitl.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import pytest

from airflow.providers.standard.exceptions import HITLTimeoutError, HITLTriggerEventError

from tests_common.test_utils.version_compat import AIRFLOW_V_3_1_PLUS

if not AIRFLOW_V_3_1_PLUS:
Expand Down Expand Up @@ -249,6 +251,28 @@ def test_execute_complete(self) -> None:
"responded_by_user": {"id": "test", "name": "test"},
}

@pytest.mark.parametrize(
"event, expected_exception",
[
({"error": "unknown", "error_type": "unknown"}, HITLTriggerEventError),
({"error": "this is timeotu", "error_type": "timeout"}, HITLTimeoutError),
],
)
def test_process_trigger_event_error(
self,
event: dict[str, Any],
expected_exception,
) -> None:
hitl_op = HITLOperator(
task_id="hitl_test",
subject="This is subject",
body="This is body",
options=["1", "2", "3", "4", "5"],
params={"input": 1},
)
with pytest.raises(expected_exception):
hitl_op.process_trigger_event_error(event)

def test_validate_chosen_options_with_invalid_content(self) -> None:
hitl_op = HITLOperator(
task_id="hitl_test",
Expand Down