"""Test for notify started task.""" from unittest.mock import MagicMock, patch from tasks.apply_adjustments.notify_started import notify_started_task @patch('tasks.apply_adjustments.notify_started.' 'ows.update_abacus_state') @patch('tasks.apply_adjustments.notify_started.' 'helpers.get_abacus_state') def test_notify_started_task( mock_helpers_get_abacus_state: MagicMock, mock_ows_update_abacus_state: MagicMock, mock_apply_adjustments_run, ): """Test for updating action_status to 'running'.""" 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_started_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': 'running' } )