"""Test for Notify mechanicals started task.""" from unittest.mock import MagicMock, patch from tasks.accounting_period_mechanicals.notify_started import notify_started_task @patch('tasks.accounting_period_mechanicals.notify_started.' 'ows.update_abacus_state') @patch('tasks.accounting_period_mechanicals.notify_started.' 'helpers.get_mechanical_deduction_state') def test_notify_started_task( mock_helpers_get_mechanical_deduction_state: MagicMock, mock_ows_update_abacus_state: MagicMock, mock_accounting_period_mechanicals_event, mock_accounting_period_mechanicals_dag_run, ): """Test updating accounting period status.""" mock_helpers_get_mechanical_deduction_state.return_value = { 'abacus_state_id': 6, 'action_name': 'prep_mechanical_deductions', } res = notify_started_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': 'running'} )