"""Test for notify mechanicals success task.""" from unittest.mock import MagicMock, patch from tasks.accounting_period_mechanicals.notify_success import notify_success_task @patch('tasks.accounting_period_mechanicals.notify_success.' 'ows.update_abacus_state') @patch('tasks.accounting_period_mechanicals.notify_success.' 'helpers.get_mechanical_deduction_state') def test_notify_success_task( mock_helpers_get_mechanical_deduction_state: MagicMock, mock_ows_update_abacus_state: MagicMock, mock_accounting_period_mechanicals_dag_run, mock_accounting_period_mechanicals_event, ): """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_success_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': 'complete'} )