"""Test for notify success task.""" from unittest.mock import MagicMock, patch from tasks.payoneer_payments_payout.notify_success import notify_success_task @patch('tasks.payoneer_payments_payout.notify_failure.ows.update_abacus_state') @patch('tasks.payoneer_payments_payout.notify_failure.ows.get_abacus_state_id') def test_notify_success_task( mock_ows_get_abacus_state_id: MagicMock, mock_ows_update_abacus_state: MagicMock, mock_payoneer_payment_payout_event, mock_payoneer_payments_payout_run, ): """Test for updating action_status to 'complete'.""" mock_abacus_states = [ {'abacus_state_id': 33, 'action_name': 'send_payments'} ] mock_ows_get_abacus_state_id.return_value = mock_abacus_states[0]['abacus_state_id'] mock_params = {'action_name': 'send_payments'} res = notify_success_task(mock_payoneer_payments_payout_run, **mock_params) assert res is None mock_ows_get_abacus_state_id.assert_called_once_with( 'payment_group_payment', mock_payoneer_payment_payout_event['target_id'], 'send_payments', ) mock_ows_update_abacus_state.assert_called_once_with( 33, body={'action_status': 'complete'}, )