コード例 #1
0
def getAllReturnVals(obj: Any, method: SpyableMethod,
                     compare_val_to=None) -> List[Any]:
    """

    :param obj:
    :param method: method name or method
    :param compare_val_to: if provided, only returns values which are equal to
    the provided one. Won't work if the provided value is None
    :return: a list of return vals
    """
    methodName = method if isinstance(method, str) else getCallableName(method)
    return [m.result for m in obj.spylog.getAll(methodName)
            if (compare_val_to is None or m.result == compare_val_to)]
def test_cancel_request_cp_and_ls_after_catchup(txnPoolNodeSet,
                                                looper,
                                                sdk_pool_handle,
                                                sdk_wallet_steward,
                                                tconf,
                                                tdir,
                                                allPluginsPath):
    '''Test cancel of schedule with requesting ledger statuses and consistency
    proofs after catchup.'''
    node_to_disconnect = txnPoolNodeSet[-1]
    sdk_send_random_and_check(looper, txnPoolNodeSet,
                              sdk_pool_handle, sdk_wallet_steward, 5)

    # restart node
    disconnect_node_and_ensure_disconnected(looper,
                                            txnPoolNodeSet,
                                            node_to_disconnect)
    looper.removeProdable(name=node_to_disconnect.name)
    sdk_send_random_and_check(looper, txnPoolNodeSet,
                              sdk_pool_handle, sdk_wallet_steward,
                              2)
    # add node_to_disconnect to pool
    node_to_disconnect = start_stopped_node(node_to_disconnect, looper, tconf,
                                            tdir, allPluginsPath)
    txnPoolNodeSet[-1] = node_to_disconnect
    looper.run(checkNodesConnected(txnPoolNodeSet))
    waitNodeDataEquality(looper, node_to_disconnect, *txnPoolNodeSet)

    # check cancel of schedule with requesting ledger statuses and consistency proofs

    assert len(node_to_disconnect.ledgerManager.request_ledger_status_action_ids) == 0
    for action, aids in node_to_disconnect.ledgerManager.scheduled.items():
        if getCallableName(action) == 'reask_for_ledger_status':
            assert len(aids) == 0

    assert len(node_to_disconnect.ledgerManager.request_consistency_proof_action_ids) == 0
    for action, aids in node_to_disconnect.ledgerManager.scheduled.items():
        if getCallableName(action) == 'reask_for_last_consistency_proof':
            assert len(aids) == 0
コード例 #3
0
def test_cancel_request_cp_and_ls_after_catchup(txnPoolNodeSet, looper,
                                                sdk_pool_handle,
                                                sdk_wallet_steward, tconf,
                                                tdir, allPluginsPath):
    '''Test cancel of schedule with requesting ledger statuses and consistency
    proofs after catchup.'''
    node_to_disconnect = txnPoolNodeSet[-1]
    sdk_send_random_and_check(looper, txnPoolNodeSet, sdk_pool_handle,
                              sdk_wallet_steward, 5)

    # restart node
    disconnect_node_and_ensure_disconnected(looper, txnPoolNodeSet,
                                            node_to_disconnect)
    looper.removeProdable(name=node_to_disconnect.name)
    sdk_send_random_and_check(looper, txnPoolNodeSet, sdk_pool_handle,
                              sdk_wallet_steward, 2)
    # add node_to_disconnect to pool
    node_to_disconnect = start_stopped_node(node_to_disconnect, looper, tconf,
                                            tdir, allPluginsPath)
    txnPoolNodeSet[-1] = node_to_disconnect
    looper.run(checkNodesConnected(txnPoolNodeSet))
    waitNodeDataEquality(looper, node_to_disconnect, *txnPoolNodeSet)

    # check cancel of schedule with requesting ledger statuses and consistency proofs

    assert len(
        node_to_disconnect.ledgerManager.request_ledger_status_action_ids) == 0
    for action, aids in node_to_disconnect.ledgerManager.scheduled.items():
        if getCallableName(action) == 'reask_for_ledger_status':
            assert len(aids) == 0

    assert len(node_to_disconnect.ledgerManager.
               request_consistency_proof_action_ids) == 0
    for action, aids in node_to_disconnect.ledgerManager.scheduled.items():
        if getCallableName(action) == 'reask_for_last_consistency_proof':
            assert len(aids) == 0
コード例 #4
0
ファイル: delayers.py プロジェクト: cam-parra/indy-plenum
 def inner(action_pair):
     action, actionId = action_pair
     actionName = getCallableName(action)
     if actionName == method.__name__:
         return delay
コード例 #5
0
def getAllArgs(obj: Any, method: Union[str, Callable]) -> List[Any]:
    # params should return a List
    methodName = method if isinstance(method, str) else getCallableName(method)
    return [m.params for m in obj.spylog.getAll(methodName)]
コード例 #6
0
ファイル: delayers.py プロジェクト: evernym/plenum
 def inner(action_pair):
     action, actionId = action_pair
     actionName = getCallableName(action)
     if actionName == method.__name__:
         return delay
コード例 #7
0
def getAllReturnVals(obj: Any, method: SpyableMethod) -> List[Any]:
    # params should return a List
    methodName = method if isinstance(method, str) else getCallableName(method)
    return [m.result for m in obj.spylog.getAll(methodName)]
コード例 #8
0
ファイル: spy_helpers.py プロジェクト: evernym/plenum
def getAllArgs(obj: Any, method: Union[str, Callable]) -> List[Any]:
    # params should return a List
    methodName = method if isinstance(method, str) else getCallableName(method)
    return [m.params for m in obj.spylog.getAll(methodName)]