def test_state_proof_returned_for_get_attr(looper,
                                           sdk_added_raw_attribute,
                                           attributeName,
                                           attributeData,
                                           sdk_pool_handle,
                                           sdk_wallet_client):
    """
    Tests that state proof is returned in the reply for GET_ATTR transactions.
    Use different submitter and reader!
    """
    get_attr_operation = {
        TARGET_NYM: sdk_added_raw_attribute['operation']['dest'],
        TXN_TYPE: GET_ATTR,
        RAW: attributeName
    }
    replies = sdk_submit_operation_and_get_replies(looper, sdk_pool_handle,
                                                   sdk_wallet_client,
                                                   get_attr_operation)
    expected_data = attrib_raw_data_serializer.deserialize(attributeData)
    for reply in replies:
        result = reply[1]['result']
        assert DATA in result
        data = attrib_raw_data_serializer.deserialize(result[DATA])
        assert data == expected_data
        assert result[TXN_TIME]
        check_valid_proof(reply[1])
def test_state_proof_returned_for_get_nym(looper, sdk_user_wallet_a,
                                          sdk_pool_handle, sdk_wallet_client,
                                          sdk_wallet_trust_anchor):
    """
    Tests that state proof is returned in the reply for GET_NYM transactions.
    Use different submitter and reader!
    """
    _, dest = sdk_user_wallet_a

    nym_operation = {TARGET_NYM: dest, TXN_TYPE: NYM}

    sdk_submit_operation_and_get_replies(looper, sdk_pool_handle,
                                         sdk_wallet_trust_anchor,
                                         nym_operation)

    get_nym_operation = {TARGET_NYM: dest, TXN_TYPE: GET_NYM}

    replies = sdk_submit_operation_and_get_replies(looper, sdk_pool_handle,
                                                   sdk_wallet_client,
                                                   get_nym_operation)
    for reply in replies:
        result = reply[1]['result']
        assert DATA in result
        assert result[DATA]
        data = domain_state_serializer.deserialize(result[DATA])
        assert ROLE in data
        assert VERKEY in data
        assert f.IDENTIFIER.nm in data
        assert result[TXN_TIME]
        check_valid_proof(reply[1])
def test_state_proof_returned_for_get_attr(looper,
                                           addedRawAttribute,
                                           attributeName,
                                           attributeData,
                                           client1, wallet1):
    """
    Tests that state proof is returned in the reply for GET_ATTR transactions.
    Use different submitter and reader!
    """
    get_attr_operation = {
        TARGET_NYM: addedRawAttribute.dest,
        TXN_TYPE: GET_ATTR,
        RAW: attributeName
    }
    replies = submit_operation_and_get_replies(looper,
                                               wallet1, client1,
                                               get_attr_operation)
    expected_data = attrib_raw_data_serializer.deserialize(attributeData)
    for reply in replies:
        result = reply['result']
        assert DATA in result
        data = attrib_raw_data_serializer.deserialize(result[DATA])
        assert data == expected_data
        assert result[TXN_TIME]
        check_valid_proof(reply, client1)
Ejemplo n.º 4
0
def test_state_proof_returned_for_get_claim_def(looper, trustAnchor,
                                                trustAnchorWallet, client1,
                                                wallet1):
    """
    Tests that state proof is returned in the reply for GET_CLAIM_DEF
    transactions.
    Use different submitter and reader!
    """
    dest = trustAnchorWallet.defaultId
    data = {"primary": {'N': '123'}, REVOCATION: {'h0': '456'}}
    claim_def_operation = {
        TXN_TYPE: CLAIM_DEF,
        REF: 12,
        DATA: data,
        SIGNATURE_TYPE: 'CL'
    }
    submit_operation_and_get_replies(looper, trustAnchorWallet, trustAnchor,
                                     claim_def_operation)
    get_claim_def_operation = {
        ORIGIN: dest,
        TXN_TYPE: GET_CLAIM_DEF,
        REF: 12,
        SIGNATURE_TYPE: 'CL'
    }
    replies = submit_operation_and_get_replies(looper, wallet1, client1,
                                               get_claim_def_operation)
    expected_data = data
    for reply in replies:
        result = reply['result']
        assert DATA in result
        data = result.get(DATA)
        assert data
        assert data == expected_data
        assert result[TXN_TIME]
        check_valid_proof(reply, client1)
def test_state_proof_returned_for_missing_schema(looper,
                                                 trustAnchor,
                                                 trustAnchorWallet):
    """
    Tests that state proof is returned in the reply for GET_SCHEMA transactions
    """
    client = trustAnchor
    dest = trustAnchorWallet.defaultId
    schema_name = "test_schema"
    schema_version = "1.0"
    get_schema_operation = {
        TARGET_NYM: dest,
        TXN_TYPE: GET_SCHEMA,
        DATA: {
            NAME: schema_name,
            VERSION: schema_version,
        }
    }
    replies = submit_operation_and_get_replies(looper, trustAnchorWallet,
                                               trustAnchor,
                                               get_schema_operation)
    for reply in replies:
        result = reply[f.RESULT.nm]
        assert ATTR_NAMES not in result[DATA]
        check_valid_proof(reply, client)
def test_state_proof_returned_for_get_attr(looper,
                                           sdk_added_raw_attribute,
                                           attributeName,
                                           attributeData,
                                           sdk_pool_handle,
                                           sdk_wallet_client):
    """
    Tests that state proof is returned in the reply for GET_ATTR transactions.
    Use different submitter and reader!
    """
    get_attr_operation = {
        TARGET_NYM: sdk_added_raw_attribute['operation']['dest'],
        TXN_TYPE: GET_ATTR,
        RAW: attributeName
    }
    replies = sdk_submit_operation_and_get_replies(looper, sdk_pool_handle,
                                                   sdk_wallet_client,
                                                   get_attr_operation)
    expected_data = attrib_raw_data_serializer.deserialize(attributeData)
    for reply in replies:
        result = reply[1]['result']
        assert DATA in result
        data = attrib_raw_data_serializer.deserialize(result[DATA])
        assert data == expected_data
        assert result[TXN_TIME]
        check_valid_proof(reply[1])
Ejemplo n.º 7
0
def test_state_proof_returned_for_get_nym(looper, trustAnchor,
                                          trustAnchorWallet, userWalletA,
                                          client1, wallet1):
    """
    Tests that state proof is returned in the reply for GET_NYM transactions.
    Use different submitter and reader!
    """
    dest = userWalletA.defaultId

    nym_operation = {TARGET_NYM: dest, TXN_TYPE: NYM}

    submit_operation_and_get_replies(looper, trustAnchorWallet, trustAnchor,
                                     nym_operation)

    get_nym_operation = {TARGET_NYM: dest, TXN_TYPE: GET_NYM}

    replies = submit_operation_and_get_replies(looper, wallet1, client1,
                                               get_nym_operation)
    for reply in replies:
        result = reply['result']
        assert DATA in result
        assert result[DATA]
        data = domain_state_serializer.deserialize(result[DATA])
        assert ROLE in data
        assert VERKEY in data
        assert f.IDENTIFIER.nm in data
        assert result[TXN_TIME]
        check_valid_proof(reply, client1)
def test_state_proof_returned_for_missing_schema(looper, trustAnchor,
                                                 trustAnchorWallet):
    """
    Tests that state proof is returned in the reply for GET_NYM transactions
    """
    client = trustAnchor
    dest = trustAnchorWallet.defaultId
    schema_name = "test_schema"
    schema_version = "1.0"
    get_schema_operation = {
        TARGET_NYM: dest,
        TXN_TYPE: GET_SCHEMA,
        DATA: {
            NAME: schema_name,
            VERSION: schema_version,
        }
    }
    get_schema_request = trustAnchorWallet.signOp(get_schema_operation)
    trustAnchorWallet.pendRequest(get_schema_request)
    pending = trustAnchorWallet.preparePending()
    client.submitReqs(*pending)
    waitForSufficientRepliesForRequests(looper, trustAnchor, requests=pending)
    replies = getRepliesFromClientInbox(client.inBox, get_schema_request.reqId)
    for reply in replies:
        result = reply['result']
        assert ATTR_NAMES not in result[DATA]
        check_valid_proof(reply, client)
def test_state_proof_returned_for_get_attr(looper,
                                           addedRawAttribute,
                                           attributeName,
                                           attributeData,
                                           trustAnchor,
                                           trustAnchorWallet):
    """
    Tests that state proof is returned in the reply for GET_ATTR transactions
    """
    client = trustAnchor
    get_attr_operation = {
        TARGET_NYM: addedRawAttribute.dest,
        TXN_TYPE: GET_ATTR,
        RAW: attributeName
    }
    get_attr_request = trustAnchorWallet.signOp(get_attr_operation)
    trustAnchorWallet.pendRequest(get_attr_request)
    pending = trustAnchorWallet.preparePending()
    client.submitReqs(*pending)
    waitForSufficientRepliesForRequests(looper, trustAnchor, requests=pending)
    replies = getRepliesFromClientInbox(client.inBox, get_attr_request.reqId)
    expected_data = attrib_raw_data_serializer.deserialize(attributeData)
    for reply in replies:
        result = reply['result']
        assert DATA in result
        data = attrib_raw_data_serializer.deserialize(result[DATA])
        assert data == expected_data
        assert result[TXN_TIME]
        check_valid_proof(reply, client)
def test_state_proof_returned_for_get_schema(looper,
                                             trustAnchor,
                                             trustAnchorWallet):
    """
    Tests that state proof is returned in the reply for GET_NYM transactions
    """
    client = trustAnchor
    dest = trustAnchorWallet.defaultId
    schema_name = "test_schema"
    schema_version = "1.0"
    schema_attr_names = ["width", "height"]
    data = {
        NAME: schema_name,
        VERSION: schema_version,
        ATTR_NAMES: schema_attr_names
    }
    schema_operation = {
        TXN_TYPE: SCHEMA,
        DATA: data
    }
    nym_request = trustAnchorWallet.signOp(schema_operation)
    trustAnchorWallet.pendRequest(nym_request)
    pending = trustAnchorWallet.preparePending()
    client.submitReqs(*pending)
    waitForSufficientRepliesForRequests(looper, trustAnchor, requests=pending)
    get_schema_operation = {
        TARGET_NYM: dest,
        TXN_TYPE: GET_SCHEMA,
        DATA: {
            NAME: schema_name,
            VERSION: schema_version,
        }
    }
    get_schema_request = trustAnchorWallet.signOp(get_schema_operation)
    trustAnchorWallet.pendRequest(get_schema_request)
    pending = trustAnchorWallet.preparePending()
    client.submitReqs(*pending)
    waitForSufficientRepliesForRequests(looper, trustAnchor, requests=pending)
    replies = getRepliesFromClientInbox(client.inBox, get_schema_request.reqId)
    for reply in replies:
        result = reply['result']
        assert DATA in result
        data = result.get(DATA)
        assert data
        assert ATTR_NAMES in data
        assert data[ATTR_NAMES] == schema_attr_names
        assert NAME in data
        assert VERSION in data
        assert result[TXN_TIME]
        check_valid_proof(reply, client)
def test_state_proof_returned_for_get_schema(looper,
                                             sdk_wallet_trust_anchor,
                                             sdk_pool_handle,
                                             sdk_wallet_client):
    """
    Tests that state proof is returned in the reply for GET_SCHEMA transactions.
    Use different submitter and reader!
    """
    _, dest = sdk_wallet_trust_anchor
    schema_name = "test_schema"
    schema_version = "1.0"
    schema_attr_names = ["width", "height"]
    data = {
        NAME: schema_name,
        VERSION: schema_version,
        ATTR_NAMES: schema_attr_names
    }
    schema_operation = {
        TXN_TYPE: SCHEMA,
        DATA: data
    }
    sdk_submit_operation_and_get_replies(looper,
                                         sdk_pool_handle,
                                         sdk_wallet_trust_anchor,
                                         schema_operation)

    get_schema_operation = {
        TARGET_NYM: dest,
        TXN_TYPE: GET_SCHEMA,
        DATA: {
            NAME: schema_name,
            VERSION: schema_version,
        }
    }
    replies = sdk_submit_operation_and_get_replies(looper, sdk_pool_handle,
                                                   sdk_wallet_client,
                                                   get_schema_operation)
    for reply in replies:
        result = reply[1]['result']
        assert DATA in result
        data = result.get(DATA)
        assert data
        assert ATTR_NAMES in data
        assert data[ATTR_NAMES] == schema_attr_names
        assert NAME in data
        assert VERSION in data
        assert result[TXN_TIME]
        check_valid_proof(reply[1])
def test_state_proof_returned_for_get_schema(looper,
                                             sdk_wallet_trust_anchor,
                                             sdk_pool_handle,
                                             sdk_wallet_client):
    """
    Tests that state proof is returned in the reply for GET_SCHEMA transactions.
    Use different submitter and reader!
    """
    _, dest = sdk_wallet_trust_anchor
    schema_name = "test_schema"
    schema_version = "1.0"
    schema_attr_names = ["width", "height"]
    data = {
        SCHEMA_NAME: schema_name,
        SCHEMA_VERSION: schema_version,
        SCHEMA_ATTR_NAMES: schema_attr_names
    }
    schema_operation = {
        TXN_TYPE: SCHEMA,
        DATA: data
    }
    sdk_submit_operation_and_get_replies(looper,
                                         sdk_pool_handle,
                                         sdk_wallet_trust_anchor,
                                         schema_operation)

    get_schema_operation = {
        TARGET_NYM: dest,
        TXN_TYPE: GET_SCHEMA,
        DATA: {
            NAME: schema_name,
            VERSION: schema_version,
        }
    }
    replies = sdk_submit_operation_and_get_replies(looper, sdk_pool_handle,
                                                   sdk_wallet_client,
                                                   get_schema_operation)
    for reply in replies:
        result = reply[1]['result']
        assert DATA in result
        data = result.get(DATA)
        assert data
        assert SCHEMA_ATTR_NAMES in data
        assert data[SCHEMA_ATTR_NAMES] == schema_attr_names
        assert NAME in data
        assert VERSION in data
        assert result[TXN_TIME]
        check_valid_proof(reply[1])
def test_state_proof_returned_for_get_nym(looper,
                                          trustAnchor,
                                          trustAnchorWallet,
                                          userWalletA):
    """
    Tests that state proof is returned in the reply for GET_NYM transactions
    """
    client = trustAnchor
    dest = userWalletA.defaultId

    nym = {
        TARGET_NYM: dest,
        TXN_TYPE: NYM
    }
    nym_request = trustAnchorWallet.signOp(nym)
    trustAnchorWallet.pendRequest(nym_request)
    pending = trustAnchorWallet.preparePending()
    client.submitReqs(*pending)

    get_nym_operation = {
        TARGET_NYM: dest,
        TXN_TYPE: GET_NYM
    }

    get_nym_request = trustAnchorWallet.signOp(get_nym_operation)
    trustAnchorWallet.pendRequest(get_nym_request)
    pending = trustAnchorWallet.preparePending()
    client.submitReqs(*pending)
    waitForSufficientRepliesForRequests(looper, trustAnchor, requests=pending)
    replies = getRepliesFromClientInbox(client.inBox, get_nym_request.reqId)

    for reply in replies:
        result = reply['result']
        assert DATA in result
        assert result[DATA]
        data = domain_state_serializer.deserialize(result[DATA])
        assert ROLE in data
        assert VERKEY in data
        assert f.IDENTIFIER.nm in data
        assert result[TXN_TIME]
        check_valid_proof(reply, client)
def test_state_proof_returned_for_get_claim_def(looper,
                                                trustAnchor,
                                                trustAnchorWallet):
    """
    Tests that state proof is returned in the reply for GET_NYM transactions
    """
    client = trustAnchor
    dest = trustAnchorWallet.defaultId
    data = {"primary": {'N': '123'}, REVOCATION: {'h0': '456'}}
    claim_def_operation = {
        TXN_TYPE: CLAIM_DEF,
        REF: 12,
        DATA: data,
        SIGNATURE_TYPE: 'CL'
    }
    nym_request = trustAnchorWallet.signOp(claim_def_operation)
    trustAnchorWallet.pendRequest(nym_request)
    pending = trustAnchorWallet.preparePending()
    client.submitReqs(*pending)
    waitForSufficientRepliesForRequests(looper, trustAnchor, requests=pending)
    get_claim_def_operation = {
        ORIGIN: dest,
        TXN_TYPE: GET_CLAIM_DEF,
        REF: 12,
        SIGNATURE_TYPE: 'CL'
    }
    get_schema_request = trustAnchorWallet.signOp(get_claim_def_operation)
    trustAnchorWallet.pendRequest(get_schema_request)
    pending = trustAnchorWallet.preparePending()
    client.submitReqs(*pending)
    waitForSufficientRepliesForRequests(looper, trustAnchor, requests=pending)
    replies = getRepliesFromClientInbox(client.inBox, get_schema_request.reqId)
    expected_data = data
    for reply in replies:
        result = reply['result']
        assert DATA in result
        data = result.get(DATA)
        assert data
        assert data == expected_data
        assert result[TXN_TIME]
        check_valid_proof(reply, client)
Ejemplo n.º 15
0
def test_state_proof_returned_for_get_schema(looper, trustAnchor,
                                             trustAnchorWallet, client1,
                                             wallet1):
    """
    Tests that state proof is returned in the reply for GET_SCHEMA transactions.
    Use different submitter and reader!
    """
    dest = trustAnchorWallet.defaultId
    schema_name = "test_schema"
    schema_version = "1.0"
    schema_attr_names = ["width", "height"]
    data = {
        NAME: schema_name,
        VERSION: schema_version,
        ATTR_NAMES: schema_attr_names
    }
    schema_operation = {TXN_TYPE: SCHEMA, DATA: data}
    submit_operation_and_get_replies(looper, trustAnchorWallet, trustAnchor,
                                     schema_operation)

    get_schema_operation = {
        TARGET_NYM: dest,
        TXN_TYPE: GET_SCHEMA,
        DATA: {
            NAME: schema_name,
            VERSION: schema_version,
        }
    }
    replies = submit_operation_and_get_replies(looper, wallet1, client1,
                                               get_schema_operation)
    for reply in replies:
        result = reply['result']
        assert DATA in result
        data = result.get(DATA)
        assert data
        assert ATTR_NAMES in data
        assert data[ATTR_NAMES] == schema_attr_names
        assert NAME in data
        assert VERSION in data
        assert result[TXN_TIME]
        check_valid_proof(reply, client1)
def test_state_proof_returned_for_missing_attr(looper, attributeName,
                                               trustAnchor, trustAnchorWallet):
    """
    Tests that state proof is returned in the reply for GET_ATTR transactions
    """
    client = trustAnchor
    get_attr_operation = {
        TARGET_NYM: trustAnchorWallet.defaultId,
        TXN_TYPE: GET_ATTR,
        RAW: attributeName
    }
    get_attr_request = trustAnchorWallet.signOp(get_attr_operation)
    trustAnchorWallet.pendRequest(get_attr_request)
    pending = trustAnchorWallet.preparePending()
    client.submitReqs(*pending)
    waitForSufficientRepliesForRequests(looper, trustAnchor, requests=pending)
    replies = getRepliesFromClientInbox(client.inBox, get_attr_request.reqId)
    for reply in replies:
        result = reply['result']
        assert DATA not in result or result[DATA] is None
        check_valid_proof(reply, client)
def test_state_proof_returned_for_get_claim_def(looper,
                                                sdk_wallet_trust_anchor,
                                                sdk_pool_handle,
                                                sdk_wallet_client):
    """
    Tests that state proof is returned in the reply for GET_CLAIM_DEF
    transactions.
    Use different submitter and reader!
    """
    _, dest = sdk_wallet_trust_anchor
    data = {"primary": {'N': '123'}, REVOCATION: {'h0': '456'}}
    claim_def_operation = {
        TXN_TYPE: CLAIM_DEF,
        CLAIM_DEF_SCHEMA_REF: 12,
        DATA: data,
        CLAIM_DEF_SIGNATURE_TYPE: 'CL'
    }
    sdk_submit_operation_and_get_replies(looper,
                                         sdk_pool_handle,
                                         sdk_wallet_trust_anchor,
                                         claim_def_operation)
    get_claim_def_operation = {
        CLAIM_DEF_FROM: dest,
        TXN_TYPE: GET_CLAIM_DEF,
        CLAIM_DEF_SCHEMA_REF: 12,
        CLAIM_DEF_SIGNATURE_TYPE: 'CL'
    }
    replies = sdk_submit_operation_and_get_replies(looper,
                                                   sdk_pool_handle,
                                                   sdk_wallet_client,
                                                   get_claim_def_operation)
    expected_data = data
    for reply in replies:
        result = reply[1]['result']
        assert DATA in result
        data = result.get(DATA)
        assert data
        assert data == expected_data
        assert result[TXN_TIME]
        check_valid_proof(reply[1])
def test_state_proof_returned_for_get_claim_def(looper,
                                                sdk_wallet_trust_anchor,
                                                sdk_pool_handle,
                                                sdk_wallet_client):
    """
    Tests that state proof is returned in the reply for GET_CLAIM_DEF
    transactions.
    Use different submitter and reader!
    """
    _, dest = sdk_wallet_trust_anchor
    data = {"primary": {'N': '123'}, REVOCATION: {'h0': '456'}}
    claim_def_operation = {
        TXN_TYPE: CLAIM_DEF,
        REF: 12,
        DATA: data,
        SIGNATURE_TYPE: 'CL'
    }
    sdk_submit_operation_and_get_replies(looper,
                                         sdk_pool_handle,
                                         sdk_wallet_trust_anchor,
                                         claim_def_operation)
    get_claim_def_operation = {
        ORIGIN: dest,
        TXN_TYPE: GET_CLAIM_DEF,
        REF: 12,
        SIGNATURE_TYPE: 'CL'
    }
    replies = sdk_submit_operation_and_get_replies(looper,
                                                   sdk_pool_handle,
                                                   sdk_wallet_client,
                                                   get_claim_def_operation)
    expected_data = data
    for reply in replies:
        result = reply[1]['result']
        assert DATA in result
        data = result.get(DATA)
        assert data
        assert data == expected_data
        assert result[TXN_TIME]
        check_valid_proof(reply[1])
Ejemplo n.º 19
0
def test_state_proof_returned_for_get_attr(looper, addedRawAttribute,
                                           attributeName, attributeData,
                                           client1, wallet1):
    """
    Tests that state proof is returned in the reply for GET_ATTR transactions.
    Use different submitter and reader!
    """
    get_attr_operation = {
        TARGET_NYM: addedRawAttribute.dest,
        TXN_TYPE: GET_ATTR,
        RAW: attributeName
    }
    replies = submit_operation_and_get_replies(looper, wallet1, client1,
                                               get_attr_operation)
    expected_data = attrib_raw_data_serializer.deserialize(attributeData)
    for reply in replies:
        result = reply['result']
        assert DATA in result
        data = attrib_raw_data_serializer.deserialize(result[DATA])
        assert data == expected_data
        assert result[TXN_TIME]
        check_valid_proof(reply, client1)
def test_state_proof_returned_for_get_nym(looper,
                                          trustAnchor,
                                          trustAnchorWallet,
                                          userWalletA,
                                          client1, wallet1):
    """
    Tests that state proof is returned in the reply for GET_NYM transactions.
    Use different submitter and reader!
    """
    dest = userWalletA.defaultId

    nym_operation = {
        TARGET_NYM: dest,
        TXN_TYPE: NYM
    }

    submit_operation_and_get_replies(looper,
                                     trustAnchorWallet, trustAnchor,
                                     nym_operation)

    get_nym_operation = {
        TARGET_NYM: dest,
        TXN_TYPE: GET_NYM
    }

    replies = submit_operation_and_get_replies(looper,
                                               wallet1, client1,
                                               get_nym_operation)
    for reply in replies:
        result = reply['result']
        assert DATA in result
        assert result[DATA]
        data = domain_state_serializer.deserialize(result[DATA])
        assert ROLE in data
        assert VERKEY in data
        assert f.IDENTIFIER.nm in data
        assert result[TXN_TIME]
        check_valid_proof(reply, client1)
def test_state_proof_returned_for_get_nym(looper,
                                          sdk_user_wallet_a,
                                          sdk_pool_handle,
                                          sdk_wallet_client,
                                          sdk_wallet_trust_anchor):
    """
    Tests that state proof is returned in the reply for GET_NYM transactions.
    Use different submitter and reader!
    """
    _, dest = sdk_user_wallet_a

    nym_operation = {
        TARGET_NYM: dest,
        TXN_TYPE: NYM
    }

    sdk_submit_operation_and_get_replies(looper, sdk_pool_handle,
                                         sdk_wallet_trust_anchor,
                                         nym_operation)

    get_nym_operation = {
        TARGET_NYM: dest,
        TXN_TYPE: GET_NYM
    }

    replies = sdk_submit_operation_and_get_replies(looper, sdk_pool_handle,
                                                   sdk_wallet_client,
                                                   get_nym_operation)
    for reply in replies:
        result = reply[1]['result']
        assert DATA in result
        assert result[DATA]
        data = domain_state_serializer.deserialize(result[DATA])
        assert ROLE in data
        assert VERKEY in data
        assert f.IDENTIFIER.nm in data
        assert result[TXN_TIME]
        check_valid_proof(reply[1])
def test_state_proof_returned_for_missing_schema(looper, sdk_pool_handle,
                                                 sdk_wallet_trust_anchor):
    """
    Tests that state proof is returned in the reply for GET_SCHEMA transactions
    """
    _, dest = sdk_wallet_trust_anchor
    schema_name = "test_schema"
    schema_version = "1.0"
    get_schema_operation = {
        TARGET_NYM: dest,
        TXN_TYPE: GET_SCHEMA,
        DATA: {
            SCHEMA_NAME: schema_name,
            SCHEMA_VERSION: schema_version,
        }
    }
    replies = sdk_submit_operation_and_get_replies(looper, sdk_pool_handle,
                                                   sdk_wallet_trust_anchor,
                                                   get_schema_operation)
    for reply in replies:
        result = reply[1][f.RESULT.nm]
        assert SCHEMA_ATTR_NAMES not in result[DATA]
        check_valid_proof(reply[1])
def test_state_proof_returned_for_missing_claim_def(looper, trustAnchor,
                                                    trustAnchorWallet):
    """
    Tests that state proof is returned in the reply for GET_NYM transactions
    """
    client = trustAnchor
    dest = trustAnchorWallet.defaultId
    get_claim_def_operation = {
        ORIGIN: dest,
        TXN_TYPE: GET_CLAIM_DEF,
        REF: 12,
        SIGNATURE_TYPE: 'CL'
    }
    get_schema_request = trustAnchorWallet.signOp(get_claim_def_operation)
    trustAnchorWallet.pendRequest(get_schema_request)
    pending = trustAnchorWallet.preparePending()
    client.submitReqs(*pending)
    waitForSufficientRepliesForRequests(looper, trustAnchor, requests=pending)
    replies = getRepliesFromClientInbox(client.inBox, get_schema_request.reqId)
    for reply in replies:
        result = reply['result']
        assert DATA not in result or result[DATA] is None
        check_valid_proof(reply, client)
def test_state_proof_returned_for_missing_nym(looper, trustAnchor,
                                              trustAnchorWallet, userWalletA):
    """
    Tests that state proof is returned in the reply for GET_NYM transactions
    """
    client = trustAnchor
    # Make not existing id
    dest = userWalletA.defaultId
    dest = dest[:-3]
    dest += "fff"

    get_nym_operation = {TARGET_NYM: dest, TXN_TYPE: GET_NYM}

    get_nym_request = trustAnchorWallet.signOp(get_nym_operation)
    trustAnchorWallet.pendRequest(get_nym_request)
    pending = trustAnchorWallet.preparePending()
    client.submitReqs(*pending)
    waitForSufficientRepliesForRequests(looper, trustAnchor, requests=pending)
    replies = getRepliesFromClientInbox(client.inBox, get_nym_request.reqId)
    for reply in replies:
        result = reply['result']
        assert DATA not in result or result[DATA] is None
        check_valid_proof(reply, client)
def test_state_proof_returned_for_missing_schema(looper, trustAnchor,
                                                 trustAnchorWallet):
    """
    Tests that state proof is returned in the reply for GET_SCHEMA transactions
    """
    client = trustAnchor
    dest = trustAnchorWallet.defaultId
    schema_name = "test_schema"
    schema_version = "1.0"
    get_schema_operation = {
        TARGET_NYM: dest,
        TXN_TYPE: GET_SCHEMA,
        DATA: {
            NAME: schema_name,
            VERSION: schema_version,
        }
    }
    replies = submit_operation_and_get_replies(looper, trustAnchorWallet,
                                               trustAnchor,
                                               get_schema_operation)
    for reply in replies:
        result = reply[f.RESULT.nm]
        assert ATTR_NAMES not in result[DATA]
        check_valid_proof(reply, client)
def check_no_data_and_valid_proof(replies):
    for reply in replies:
        result = reply[1][f.RESULT.nm]
        assert result.get(DATA) is None
        check_valid_proof(reply[1])
def check_no_data_and_valid_proof(client, replies):
    for reply in replies:
        result = reply[f.RESULT.nm]
        assert result.get(DATA) is None
        check_valid_proof(reply, client)