def test_claim_def_reply_is_valid(looper, sdk_pool_handle, sdk_wallet_steward): wallet_handle, identifier = sdk_wallet_steward schema_json, _ = sdk_write_schema(looper, sdk_pool_handle, sdk_wallet_steward) schema_id = json.loads(schema_json)['id'] request = looper.loop.run_until_complete( build_get_schema_request(identifier, schema_id)) reply = sdk_get_reply( looper, sdk_sign_and_submit_req(sdk_pool_handle, sdk_wallet_steward, request))[1] _, schema_json = looper.loop.run_until_complete( parse_get_schema_response(json.dumps(reply))) _, definition_json = looper.loop.run_until_complete( issuer_create_and_store_credential_def( wallet_handle, identifier, schema_json, "some_tag", "CL", json.dumps({"support_revocation": True}))) request = looper.loop.run_until_complete( build_cred_def_request(identifier, definition_json)) reply = sdk_get_reply( looper, sdk_sign_and_submit_req(sdk_pool_handle, sdk_wallet_steward, request))[1] validate_write_reply(reply) validate_claim_def_txn(reply['result']['txn'])
def test_attrib_enc_reply_is_valid(looper, sdk_pool_handle, sdk_wallet_steward): enc = "amgine" reply = execute_attrib_txn(looper, sdk_pool_handle, sdk_wallet_steward, None, None, enc) validate_write_reply(reply) validate_attrib_txn(reply['result']['txn']) assert reply['result']['txn']['data']['enc'] == enc
def test_attrib_raw_reply_is_valid(looper, sdk_pool_handle, sdk_wallet_steward): raw = json.dumps({'answer': 42}) reply = execute_attrib_txn(looper, sdk_pool_handle, sdk_wallet_steward, None, raw, None) validate_write_reply(reply) validate_attrib_txn(reply['result']['txn']) assert json.loads(reply['result']['txn']['data']['raw']) == json.loads(raw)
def test_attrib_xhash_reply_is_valid(looper, sdk_pool_handle, sdk_wallet_steward): xhash = sha256("Hello, world".encode()).hexdigest() reply = execute_attrib_txn(looper, sdk_pool_handle, sdk_wallet_steward, xhash, None, None) validate_write_reply(reply) validate_attrib_txn(reply['result']['txn']) assert reply['result']['txn']['data']['hash'] == xhash
def test_can_not_send_same_schema(looper, sdk_pool_handle, sdk_wallet_endorser): sdk_write_schema_and_check(looper, sdk_pool_handle, sdk_wallet_endorser, ["attrib1", "attrib2", "attrib3"], "business", "1.8") with pytest.raises(RequestRejectedException, match=str(AuthConstraintForbidden())): resp = sdk_write_schema_and_check(looper, sdk_pool_handle, sdk_wallet_endorser, ["attrib1", "attrib2", "attrib3"], "business", "1.8") validate_write_reply(resp)
def test_nym_reply_is_valid(looper, sdk_pool_handle, sdk_wallet_steward): idr, verkey = createHalfKeyIdentifierAndAbbrevVerkey() _, identifier = sdk_wallet_steward request = looper.loop.run_until_complete( build_nym_request(identifier, idr, verkey, None, None)) reply = sdk_get_reply( looper, sdk_sign_and_submit_req(sdk_pool_handle, sdk_wallet_steward, request))[1] validate_write_reply(reply) validate_nym_txn(reply['result']['txn'])
def test_can_not_send_same_schema(looper, sdk_pool_handle, sdk_wallet_trust_anchor): sdk_write_schema_and_check(looper, sdk_pool_handle, sdk_wallet_trust_anchor, ["attrib1", "attrib2", "attrib3"], "business", "1.8") with pytest.raises(RequestRejectedException) as ex_info: resp = sdk_write_schema_and_check(looper, sdk_pool_handle, sdk_wallet_trust_anchor, ["attrib1", "attrib2", "attrib3"], "business", "1.8") validate_write_reply(resp) ex_info.match( "can have one and only one SCHEMA with name business and version 1.8")
def test_rich_schema_object_reply_is_valid(looper, sdk_pool_handle, sdk_wallet_steward, txn_type, rs_type, content, rs_id): request = sdk_build_rich_schema_request(looper, sdk_wallet_steward, txn_type=txn_type, rs_id=rs_id, rs_name=randomString(), rs_version='1.0', rs_type=rs_type, rs_content=json.dumps(content)) reply = sdk_get_reply( looper, sdk_sign_and_submit_req(sdk_pool_handle, sdk_wallet_steward, request))[1] validate_write_reply(reply) validate_rich_schema_txn(reply['result']['txn'], txn_type)
def test_write_same_context_with_different_reqid_fails(looper, sdk_pool_handle, sdk_wallet_endorser): sdk_write_context_and_check( looper, sdk_pool_handle, sdk_wallet_endorser, SCHEMA_ORG_CONTEXT, "Base_Context3", "1.0", 1234 ) with pytest.raises(RequestRejectedException, match=str(AuthConstraintForbidden())): resp = sdk_write_context_and_check( looper, sdk_pool_handle, sdk_wallet_endorser, SCHEMA_ORG_CONTEXT, "Base_Context3", "1.0", 2345 ) validate_write_reply(resp)
def test_schema_reply_is_valid(looper, sdk_pool_handle, sdk_wallet_steward): _, reply = sdk_write_schema(looper, sdk_pool_handle, sdk_wallet_steward) validate_write_reply(reply) validate_schema_txn(reply['result']['txn'])