Beispiel #1
0
def test_retry_on_unexpected_exception(mock_retry: MagicMock,
                                       mock_capture_exception: MagicMock, _):
    order = dict(
        concepto_pago='PRUEBA Version 2',
        institucion_ordenante='90646',
        cuenta_beneficiario='072691004495711499',
        institucion_beneficiaria='40072',
        monto=1020,
        nombre_beneficiario='Pablo Sánchez',
        nombre_ordenante='BANCO',
        cuenta_ordenante='646180157000000004',
        rfc_curp_ordenante='ND',
        speid_id='ANOTHER_RANDOM_ID',
        version=2,
    )
    send_order(order)
    mock_retry.assert_called_once()
    mock_capture_exception.assert_called_once()
Beispiel #2
0
def test_stp_schedule_limit(mock_capture_exception: MagicMock,
                            mock_callback_queue):
    with patch('speid.tasks.orders.datetime') as mock_date:
        mock_date.utcnow.return_value = datetime(2020, 9, 1, 23, 57)
        order = dict(
            concepto_pago='PRUEBA Version 2',
            institucion_ordenante='90646',
            cuenta_beneficiario='072691004495711499',
            institucion_beneficiaria='40072',
            monto=102000000,
            nombre_beneficiario='Pablo Sánchez',
            nombre_ordenante='BANCO',
            cuenta_ordenante='646180157000000004',
            rfc_curp_ordenante='ND',
            speid_id='stp_id_again',
            version=2,
        )
        with pytest.raises(ScheduleError):
            execute(order)
        send_order(order)
        mock_capture_exception.assert_called_once()
Beispiel #3
0
def test_malformed_order_exception(mock_capture_exception: MagicMock,
                                   mock_callback_queue):
    order = dict(
        concepto_pago='PRUEBA Version 2',
        institucion_ordenante='90646',
        cuenta_beneficiario='123456789012345678',
        institucion_beneficiaria='40072',
        monto=1020,
        nombre_beneficiario='Pablo Sánchez',
        nombre_ordenante='BANCO',
        cuenta_ordenante='646180157000000004',
        rfc_curp_ordenante='ND',
        speid_id='ANOTHER_RANDOM_ID',
        version=2,
    )
    send_order(order)

    mock_capture_exception.assert_called_once()

    transaction = Transaction.objects.order_by('-created_at').first()
    transaction.delete()
Beispiel #4
0
def test_ignore_transfers_to_blocked_banks(
    mock_retry: MagicMock,
    mock_capture_exception: MagicMock,
    create_account,
    mock_callback_queue,
) -> None:
    order = dict(
        concepto_pago='PRUEBA bloqueo',
        institucion_ordenante='90646',
        cuenta_beneficiario='659802025000339321',
        institucion_beneficiaria='90659',
        monto=1020,
        nombre_beneficiario='Pablo Sánchez',
        nombre_ordenante='BANCO',
        cuenta_ordenante='646180157000000004',
        rfc_curp_ordenante='ND',
        speid_id='ANOTHER_RANDOM_ID',
        version=2,
    )
    send_order(order)
    mock_retry.assert_not_called()
    mock_capture_exception.assert_not_called()
    transaction = Transaction.objects.order_by('-created_at').first()
    transaction.delete()