async def test_create_presentation(self, mock_create_proof): mock_create_proof.return_value = "{}" mock_wallet = async_mock.MagicMock() holder = IndyHolder(mock_wallet) presentation = await holder.create_presentation( "presentation_request", "requested_credentials", "schemas", "credential_definitions", ) mock_create_proof.assert_called_once_with( mock_wallet.handle, json.dumps("presentation_request"), json.dumps("requested_credentials"), mock_wallet.master_secret_id, json.dumps("schemas"), json.dumps("credential_definitions"), json.dumps({}), ) assert presentation == json.loads("{}")
async def test_create_revocation_state(self): rr_state = { "witness": { "omega": "1 ..." }, "rev_reg": { "accum": "21 ..." }, "timestamp": 1234567890, } holder = IndyHolder("wallet") with async_mock.patch.object( test_module, "create_tails_reader", async_mock.CoroutineMock( )) as mock_create_tails_reader, async_mock.patch.object( indy.anoncreds, "create_revocation_state", async_mock.CoroutineMock()) as mock_create_rr_state: mock_create_rr_state.return_value = json.dumps(rr_state) cred_rev_id = "1" rev_reg_def = {"def": 1} rev_reg_delta = {"delta": 1} timestamp = 1234567890 tails_path = "/tmp/some.tails" result = await holder.create_revocation_state( cred_rev_id, rev_reg_def, rev_reg_delta, timestamp, tails_path) assert json.loads(result) == rr_state mock_create_rr_state.assert_awaited_once_with( mock_create_tails_reader.return_value, rev_reg_def_json=json.dumps(rev_reg_def), cred_rev_id=cred_rev_id, rev_reg_delta_json=json.dumps(rev_reg_delta), timestamp=timestamp, )
def test_init(self): holder = IndyHolder("wallet") assert holder.wallet == "wallet" assert "IndyHolder" in str(holder)
def test_init(self): holder = IndyHolder("wallet") assert holder.wallet == "wallet"