def test_get_all_auth_rule_transactions_after_write(looper, sdk_wallet_trustee, sdk_pool_handle): auth_action = ADD_PREFIX auth_type = NYM field = ROLE new_value = TRUST_ANCHOR constraint = generate_constraint_list(auth_constraints=[ generate_constraint_entity(role=TRUSTEE), generate_constraint_entity(role=STEWARD) ]) resp = sdk_send_and_check_auth_rule_request(looper, sdk_wallet_trustee, sdk_pool_handle, auth_action=auth_action, auth_type=auth_type, field=field, new_value=new_value, constraint=constraint) auth_key = ConfigReqHandler.get_auth_key(resp[0][0][OPERATION]) resp = sdk_get_auth_rule_request(looper, sdk_wallet_trustee, sdk_pool_handle) expect = {key: constraint.as_dict for key, constraint in auth_map.items()} expect[auth_key] = constraint result = resp[0][1]["result"][DATA] assert result == expect
def add_auth_rules_to_config_state( state: PruningState, auth_map: dict, serializer: AbstractConstraintSerializer): for rule_id, auth_constraint in auth_map.items(): serialized_key = rule_id.encode() serialized_value = serializer.serialize(auth_constraint) if not state.get(serialized_key, isCommitted=False): state.set(serialized_key, serialized_value)
def test_get_all_auth_rule_transactions(looper, sdk_wallet_trustee, sdk_pool_handle): resp = sdk_get_auth_rule_request(looper, sdk_wallet_trustee, sdk_pool_handle) expect = {key: constraint.as_dict for key, constraint in auth_map.items()} result = resp[0][1]["result"][DATA] assert result == expect
def test_get_all_auth_rule_transactions(looper, sdk_wallet_trustee, sdk_pool_handle): resp = sdk_get_auth_rule_request(looper, sdk_wallet_trustee, sdk_pool_handle) expect = {config.make_state_path_for_auth_rule(key).decode(): constraint.as_dict for key, constraint in auth_map.items()} result = resp[0][1]["result"][DATA] assert result == expect
def test_get_all_auth_rule_transactions(looper, sdk_wallet_trustee, sdk_pool_handle): resp = sdk_send_and_check_get_auth_rule_request(looper, sdk_pool_handle, sdk_wallet_trustee) result = resp[0][1]["result"][DATA] for i, (auth_key, constraint) in enumerate(auth_map.items()): rule = result[i] assert auth_key == ConfigReqHandler.get_auth_key(rule) if constraint is None: assert {} == rule[CONSTRAINT] else: assert constraint.as_dict == rule[CONSTRAINT]