def do_edit_claim_def(self, wallet, tag, schema_json): reply = sdk_send_claim_def(self.looper, self.sdk_pool_handle, wallet, tag, schema_json) req = reply[0][0] req[OPERATION][DATA]['primary']['n'] = 'abc' resp = sdk_sign_and_submit_op(self.looper, self.sdk_pool_handle, wallet, op=req[OPERATION]) sdk_get_and_check_replies(self.looper, [resp])
def test_auth_rule_transaction_for_edit(looper, txnPoolNodeSet, sdk_wallet_trustee, sdk_wallet_steward, sdk_pool_handle): constraint = AuthConstraint(role=STEWARD, sig_count=1, need_to_be_owner=False) req1 = build_auth_rule_request_json(looper, sdk_wallet_trustee[1], auth_action=ADD_PREFIX, auth_type=CLAIM_DEF, field='*', new_value='*', constraint=constraint.as_dict) send_and_check(looper, sdk_pool_handle, req1, wallet=sdk_wallet_trustee) constraint = AuthConstraint(role=TRUSTEE, sig_count=1, need_to_be_owner=False) req2 = build_auth_rule_request_json(looper, sdk_wallet_trustee[1], auth_action=EDIT_PREFIX, auth_type=CLAIM_DEF, field='*', old_value='*', new_value='*', constraint=constraint.as_dict) send_and_check(looper, sdk_pool_handle, req2, wallet=sdk_wallet_trustee) schema_json = get_schema_json(looper, sdk_pool_handle, sdk_wallet_trustee) reply = sdk_send_claim_def(looper, sdk_pool_handle, sdk_wallet_steward, 'tag_1', schema_json) req = reply[0][0] req[OPERATION][DATA]['primary']['n'] = 'abc' with pytest.raises(RequestRejectedException): resp = sdk_sign_and_submit_op(looper, sdk_pool_handle, sdk_wallet_steward, op=req[OPERATION]) sdk_get_and_check_replies(looper, [resp])
def run(self): schema_json = get_schema_json(self.looper, self.sdk_pool_handle, self.trustee_wallet) # Step 1. Change auth rule self.send_and_check(self.changed_auth_rule, wallet=self.trustee_wallet) # Step 2. Check, that we cannot do txn the old way with pytest.raises(RequestRejectedException): sdk_send_claim_def(self.looper, self.sdk_pool_handle, self.trustee_wallet, 'tag1', schema_json) # Step 3. Check, that new auth rule is used sdk_send_claim_def(self.looper, self.sdk_pool_handle, self.new_default_wallet, 'tag2', schema_json) # Step 4. Return default auth rule self.send_and_check(self.default_auth_rule, wallet=self.trustee_wallet) # Step 5. Check, that default auth rule works sdk_send_claim_def(self.looper, self.sdk_pool_handle, self.trustee_wallet, 'tag3', schema_json)
def get_claim_def(self): schema_json = get_schema_json(self.looper, self.sdk_pool_handle, self.trustee_wallet) return sdk_send_claim_def(self.looper, self.sdk_pool_handle, self.trustee_wallet, 'tag' + randomString(4), schema_json)