"""Test for notify mechanicals success task.""" from unittest.mock import MagicMock, patch from tasks.accounting_period_mechanicals.notify_failure import \ notify_failure_task @patch('tasks.accounting_period_mechanicals.notify_failure.' 'ows.update_abacus_state') @patch('tasks.accounting_period_mechanicals.notify_failure.' 'helpers.get_mechanical_deduction_state') def test_notify_failure( mock_helpers_get_mechanical_deduction_state: MagicMock, mock_ows_update_abacus_state: MagicMock, mock_accounting_period_mechanicals_dag_run, ): """Test updating accounting period when mechanicals finish prepping.""" mock_helpers_get_mechanical_deduction_state.return_value = { 'abacus_state_id': 6, 'action_name': 'prep_mechanical_deductions', } res = notify_failure_task(mock_accounting_period_mechanicals_dag_run) assert res is None mock_helpers_get_mechanical_deduction_state.assert_called_once_with(1024) mock_ows_update_abacus_state.assert_called_once_with( 6, body={'action_status': 'error'} )