Ejemplo n.º 1
0
def test_outgoing_transaction_invalid(outgoing_transaction,
                                      mock_callback_queue):
    speid_id = outgoing_transaction.speid_id
    to_process = [dict(speid_id=speid_id, action='invalid')]

    with pytest.raises(ValueError):
        process_outgoing_transactions(to_process)
Ejemplo n.º 2
0
def test_outgoing_transaction_doesnotexist(outgoing_transaction):
    speid_id = outgoing_transaction.speid_id
    to_process = [dict(speid_id='RANDOM', action='succeeded')]
    process_outgoing_transactions(to_process)

    transaction = Transaction.objects.get(speid_id=speid_id)
    assert transaction.estado is Estado.created
Ejemplo n.º 3
0
def test_outgoing_transaction_failed(
    outgoing_transaction, mock_callback_queue
):
    speid_id = outgoing_transaction.speid_id
    to_process = [dict(speid_id=speid_id, action='failed')]
    process_outgoing_transactions(to_process)

    transaction = Transaction.objects.get(speid_id=speid_id)
    assert transaction.estado is Estado.failed
    assert (
        len(
            [
                event
                for event in transaction.events
                if event.type is EventType.error
            ]
        )
        == 1
    )

    process_outgoing_transactions(to_process)
    transaction = Transaction.objects.get(speid_id=speid_id)
    assert transaction.estado is Estado.failed
    assert (
        len(
            [
                event
                for event in transaction.events
                if event.type is EventType.error
            ]
        )
        == 1
    )
Ejemplo n.º 4
0
def test_outgoing_transaction_succeeded(outgoing_transaction,
                                        mock_callback_queue):
    speid_id = outgoing_transaction.speid_id
    to_process = [dict(speid_id=speid_id, action='succeeded')]
    process_outgoing_transactions(to_process)

    transaction = Transaction.objects.get(speid_id=speid_id)
    assert transaction.estado is Estado.succeeded