コード例 #1
0
def test_get_one_auth_rule_transaction_tmp(looper, sdk_wallet_trustee,
                                           sdk_pool_handle):
    key = generate_key(new_value=TRUSTEE)
    str_key = ConfigReqHandler.get_auth_key(key)
    req, resp = sdk_get_auth_rule_request(looper, sdk_wallet_trustee,
                                          sdk_pool_handle, key)[0]
    assert auth_map.get(str_key).as_dict == resp["result"][DATA][str_key]
コード例 #2
0
def test_validation_nym_with_fees_more_than_required(fees,
                                                     helpers,
                                                     nodeSetWithIntegratedTokenPlugin,
                                                     address_main,
                                                     sdk_pool_handle,
                                                     sdk_wallet_trustee,
                                                     mint_tokens,
                                                     looper):
    """
    Steps:
    1. Checks that nym with fees will be rejected, because fees are not set
    2. Send auth_rule txn with fees in metadata and set fees for pool
    3. Resend nym with fees more than required and check, that it will be rejected
    """
    current_amount = get_amount_from_token_txn(mint_tokens)
    seq_no = 1
    with pytest.raises(RequestRejectedException, match="Fees are not required for this txn type"):
        current_amount, seq_no, _ = send_and_check_nym_with_fees(helpers, {FEES: fees}, seq_no, looper, [address_main],
                                                                 current_amount)


    helpers.general.do_set_fees(fees, fill_auth_map=False)
    original_action = add_new_identity_owner
    original_constraint = auth_map.get(add_new_identity_owner.get_action_id())
    original_constraint.set_metadata({'fees': NYM_FEES_ALIAS})
    sdk_send_and_check_auth_rule_request(looper,
                                         sdk_pool_handle,
                                         sdk_wallet_trustee,
                                         auth_action=ADD_PREFIX, auth_type=NYM,
                                         field=original_action.field, new_value=original_action.value,
                                         old_value=None, constraint=original_constraint.as_dict)
    with pytest.raises(RequestRejectedException, match="ExtraFundsError"):
        current_amount, seq_no, _ = send_and_check_nym_with_fees(helpers, {FEES: {NYM_FEES_ALIAS: fees[NYM_FEES_ALIAS] + 1}}, seq_no, looper, [address_main],
                                                                 current_amount)
    ensure_all_nodes_have_same_data(looper, nodeSetWithIntegratedTokenPlugin)
コード例 #3
0
def test_nym_without_fees_but_required(fees, helpers,
                                       nodeSetWithIntegratedTokenPlugin,
                                       sdk_wallet_steward, sdk_pool_handle,
                                       sdk_wallet_trustee, mint_tokens,
                                       address_main, looper):
    """
    Steps:
    1. Send auth_rule txn with fees in metadata
    2. Send nym without fees and check, that it will be rejected
    """
    helpers.general.do_set_fees(fees, fill_auth_map=False)
    original_action = add_new_identity_owner
    original_constraint = auth_map.get(add_new_identity_owner.get_action_id())
    original_constraint.set_metadata({'fees': NYM_FEES_ALIAS})
    sdk_send_and_check_auth_rule_request(
        looper,
        sdk_pool_handle,
        sdk_wallet_trustee,
        auth_action=ADD_PREFIX,
        auth_type=NYM,
        field=original_action.field,
        new_value=original_action.value,
        old_value=None,
        constraint=original_constraint.as_dict)

    with pytest.raises(RequestRejectedException,
                       match="Fees are required for this txn type"):
        helpers.general.do_nym()
コード例 #4
0
def test_get_one_auth_rule_transaction(looper, sdk_wallet_trustee,
                                       sdk_pool_handle):
    key = generate_key()
    str_key = ConfigReqHandler.get_auth_key(key)
    req, resp = sdk_get_auth_rule_request(looper, sdk_wallet_trustee,
                                          sdk_pool_handle, key)[0]
    assert auth_map.get(str_key).as_dict == \
           resp["result"][DATA][config.make_state_path_for_auth_rule(str_key).decode()]
コード例 #5
0
ファイル: basic.py プロジェクト: susy-biz/indy-node
 def get_default_auth_rule(self):
     constraint = auth_map.get(self.action_id)
     operation = generate_auth_rule_operation(auth_action=self.action.prefix,
                                              auth_type=self.action.txn_type,
                                              field=self.action.field,
                                              old_value=self.action.old_value if self.action.prefix == EDIT_PREFIX else None,
                                              new_value=self.action.new_value,
                                              constraint=constraint.as_dict)
     return sdk_gen_request(operation, identifier=self.trustee_wallet[1])
コード例 #6
0
def test_get_one_auth_rule_transaction(looper, sdk_wallet_trustee,
                                       sdk_pool_handle):
    key = generate_key()
    str_key = ConfigReqHandler.get_auth_key(key)
    req, resp = sdk_send_and_check_get_auth_rule_request(
        looper, sdk_pool_handle, sdk_wallet_trustee, **key)[0]

    for resp_rule in resp[RESULT][DATA]:
        _check_key(key, resp_rule)
        assert auth_map.get(str_key).as_dict == resp_rule[CONSTRAINT]
コード例 #7
0
def test_get_one_auth_rule_transaction(looper, sdk_wallet_trustee,
                                       sdk_pool_handle):
    key = generate_key()
    str_key = ConfigReqHandler.get_auth_key(key)
    req, resp = sdk_send_and_check_get_auth_rule_request(
        looper, sdk_pool_handle, sdk_wallet_trustee, **key)[0]

    result = resp["result"][DATA][0]
    assert len(resp["result"][DATA]) == 1
    _check_key(key, result)
    assert result[CONSTRAINT] == auth_map.get(str_key).as_dict
コード例 #8
0
ファイル: basic.py プロジェクト: ilyoungkim/indy-node
 def get_default_auth_rule(self):
     constraint = auth_map.get(self.action_id)
     return build_auth_rule_request_json(
         self.looper,
         self.trustee_wallet[1],
         auth_action=self.action.prefix,
         auth_type=self.action.txn_type,
         field=self.action.field,
         old_value=self.action.old_value
         if self.action.prefix == EDIT_PREFIX else None,
         new_value=self.action.new_value,
         constraint=constraint.as_dict)
コード例 #9
0
def test_validation_nym_with_zero_fees(helpers,
                                       nodeSetWithIntegratedTokenPlugin,
                                       sdk_wallet_steward, address_main,
                                       sdk_pool_handle, sdk_wallet_trustee,
                                       mint_tokens, looper):
    """
    Steps:
    1. Checks that nym with zero fees is valid
    2. Send auth_rule txn with zero fees in metadata
    3. Resend nym with fees and check, that it will be valid, because fees is 0, but fees are set in request
    """
    current_amount = get_amount_from_token_txn(mint_tokens)
    seq_no = 1
    fees = {NYM_FEES_ALIAS: 0}
    helpers.general.do_set_fees(fees, fill_auth_map=False)
    current_amount, seq_no, _ = send_and_check_nym_with_fees(
        helpers, {FEES: fees}, seq_no, looper, [address_main], current_amount)
    sdk_add_new_nym(looper, sdk_pool_handle, sdk_wallet_steward)

    original_action = add_new_identity_owner
    original_constraint = auth_map.get(add_new_identity_owner.get_action_id())
    original_constraint.set_metadata({'fees': NYM_FEES_ALIAS})
    sdk_send_and_check_auth_rule_request(
        looper,
        sdk_pool_handle,
        sdk_wallet_trustee,
        auth_action=ADD_PREFIX,
        auth_type=NYM,
        field=original_action.field,
        new_value=original_action.value,
        old_value=None,
        constraint=original_constraint.as_dict)
    current_amount, seq_no, _ = send_and_check_nym_with_fees(
        helpers, {FEES: fees}, seq_no, looper, [address_main], current_amount)
    sdk_add_new_nym(looper, sdk_pool_handle, sdk_wallet_steward)
    ensure_all_nodes_have_same_data(looper, nodeSetWithIntegratedTokenPlugin)