"""Test for notify_failure_task.""" from unittest.mock import MagicMock, patch from tasks.reserves_release.notify_failure import notify_failure_task @patch('tasks.reserves_release.notify_failure.ows.update_abacus_state') @patch('tasks.reserves_release.notify_failure.helpers.get_action_state') def test_notify_failure_task( mock_helpers_get_action_state: MagicMock, mock_ows_update_abacus_state: MagicMock, mock_release_reserves_event, mock_reserves_release_dag_run, ): """Test for updating statement-period action status to 'error'.""" mock_abacus_state = { 'abacus_state_id': 2, 'action_name': 'release_reserves', } mock_helpers_get_action_state.return_value = mock_abacus_state res = notify_failure_task(mock_reserves_release_dag_run) assert res is None mock_helpers_get_action_state.assert_called_once_with( mock_release_reserves_event['target_id'], 'release_reserves', ) mock_ows_update_abacus_state.assert_called_once_with( mock_abacus_state['abacus_state_id'], body={'action_status': 'error'}, )