from indy import wallet from indy.anoncreds import prover_get_claims_for_proof_req from tests.utils import storage, anoncreds from tests.utils.wallet import create_and_open_wallet import json import pytest import logging logging.basicConfig(level=logging.DEBUG) @pytest.fixture(autouse=True) def before_after_each(): storage.cleanup() yield storage.cleanup() @pytest.fixture async def wallet_handle(): handle = await create_and_open_wallet() await anoncreds.prepare_common_wallet(handle) yield handle await wallet.close_wallet(handle) @pytest.mark.asyncio async def test_prover_get_claims_for_proof_req_works_for_revealed_attr(wallet_handle): proof_req = { "nonce": "123432421212", "name": "proof_req_1", "version": "0.1", "requested_attrs": { "attr1_uuid": { "schema_seq_no": 1, "name": "name" } }, "requested_predicates": {} } claims = json.loads(await prover_get_claims_for_proof_req(wallet_handle, json.dumps(proof_req))) assert len(claims['attrs']) == 1 assert len(claims['predicates']) == 0 assert len(claims['attrs']['attr1_uuid']) == 1