"""Test for notify failure task.""" from unittest.mock import MagicMock, patch from tasks.apply_adjustments.notify_failure import notify_failure_task @patch('tasks.apply_adjustments.notify_failure.' 'ows.update_abacus_state') @patch('tasks.apply_adjustments.notify_failure.' 'helpers.get_abacus_state') def test_notify_failure_task( mock_helpers_get_abacus_state: MagicMock, mock_ows_update_abacus_state: MagicMock, mock_apply_adjustments_run, ): """Test for updating action_status to 'error'.""" mock_helpers_get_abacus_state.return_value = { 'abacus_state_id': 11, 'action_name': 'apply_pending_adjustments' } mock_params = {'action_name': 'apply_pending_adjustments'} res = notify_failure_task(mock_apply_adjustments_run, **mock_params) assert res is None mock_helpers_get_abacus_state.assert_called_once_with( 'apply_pending_adjustments', 1, ) mock_ows_update_abacus_state.assert_called_once_with( 11, body={ 'action_status': 'error' } )