Exemple #1
0
def test_events_for_withdraw_channel_open():
    """ The withdraw is done regardless of the current block. """
    transfers_pair = make_transfers_pair(
        [factories.HOP1, factories.HOP2],
        factories.HOP6,
        amount=10,
        secret=factories.UNIT_SECRET,
    )

    events = mediator.events_for_withdraw(transfers_pair, )

    assert len(events) == 0
def test_events_for_withdraw_channel_open():
    """ The withdraw is done regardless of the current block. """
    transfers_pair = make_transfers_pair(
        factories.HOP1,
        [factories.HOP2, factories.HOP3],
        factories.HOP6,
        amount=10,
        secret=factories.UNIT_SECRET,
    )

    events = mediator.events_for_withdraw(
        transfers_pair,
    )

    assert len(events) == 0
Exemple #3
0
def test_events_for_withdraw_channel_closed():
    """ The withdraw is done regardless of the current block. """
    transfers_pair = make_transfers_pair(
        [factories.HOP1, factories.HOP2],
        factories.HOP6,
        amount=10,
        secret=factories.UNIT_SECRET,
    )

    pair = transfers_pair[0]
    pair.payer_route.state = 'closed'

    # that's why this function doesn't receive the block_number
    events = mediator.events_for_withdraw(transfers_pair, )

    assert isinstance(events[0], ContractSendWithdraw)
    assert events[0].channel_address == pair.payer_route.channel_address
def test_events_for_withdraw_channel_closed():
    """ The withdraw is done regardless of the current block. """
    transfers_pair = make_transfers_pair(
        factories.HOP1,
        [factories.HOP2, factories.HOP3],
        factories.HOP6,
        amount=10,
        secret=factories.UNIT_SECRET,
    )

    pair = transfers_pair[0]
    pair.payer_route.state = CHANNEL_STATE_CLOSED

    # that's why this function doesn't receive the block_number
    events = mediator.events_for_withdraw(
        transfers_pair,
    )

    assert isinstance(events[0], ContractSendWithdraw)
    assert events[0].channel_address == pair.payer_route.channel_address