Пример #1
0
def test_non_trust_anchor_cannot_add_attribute_for_user(
        nodeSet, nonTrustAnchor, trustAnchor, addedTrustAnchor, userIdA,
        looper, attributeData):
    with whitelistextras('UnauthorizedClientRequest'):
        client, wallet = nonTrustAnchor

        createNym(looper,
                  wallet.defaultId,
                  trustAnchor,
                  addedTrustAnchor,
                  role=None,
                  verkey=wallet.getVerkey())

        attrib = Attribute(name='test1 attribute',
                           origin=wallet.defaultId,
                           value=attributeData,
                           dest=userIdA,
                           ledgerStore=LedgerStore.RAW)
        reqs = makeAttribRequest(client, wallet, attrib)
        timeout = waits.expectedTransactionExecutionTime(len(nodeSet))
        looper.run(
            eventually(checkRejects,
                       client,
                       reqs[0].reqId,
                       "UnauthorizedClientRequest('Only identity "
                       "owner/guardian can add attribute for that identity'",
                       retryWait=1,
                       timeout=timeout))
Пример #2
0
def testOnlyUsersTrustAnchorCanAddAttribute(
        nodeSet,
        looper,
        steward,
        stewardWallet,
        attributeData,
        anotherTrustAnchor,
        userIdA):
    with whitelistextras("UnauthorizedClientRequest"):
        client, wallet = anotherTrustAnchor
        attrib = Attribute(name='test2 attribute',
                           origin=wallet.defaultId,
                           value=attributeData,
                           dest=userIdA,
                           ledgerStore=LedgerStore.RAW)
        reqs = makeAttribRequest(client, wallet, attrib)
        timeout = waits.expectedReqNAckQuorumTime()
        looper.run(
            eventually(
                checkRejects,
                client,
                reqs[0].reqId,
                "UnauthorizedClientRequest('Only identity "
                "owner/guardian can add attribute for that identity'",
                retryWait=1,
                timeout=timeout))
Пример #3
0
def test_non_trust_anchor_cannot_add_attribute_for_user(
        nodeSet,
        nonTrustAnchor,
        trustAnchor,
        addedTrustAnchor,
        userIdA,
        looper,
        attributeData):
    with whitelistextras('UnauthorizedClientRequest'):
        client, wallet = nonTrustAnchor

        createNym(looper,
                  wallet.defaultId,
                  trustAnchor,
                  addedTrustAnchor,
                  role=None,
                  verkey=wallet.getVerkey())

        attrib = Attribute(name='test1 attribute',
                           origin=wallet.defaultId,
                           value=attributeData,
                           dest=userIdA,
                           ledgerStore=LedgerStore.RAW)
        reqs = makeAttribRequest(client, wallet, attrib)
        timeout = waits.expectedTransactionExecutionTime(len(nodeSet))
        looper.run(
            eventually(
                checkRejects,
                client,
                reqs[0].reqId,
                "UnauthorizedClientRequest('Only identity "
                "owner/guardian can add attribute for that identity'",
                retryWait=1,
                timeout=timeout))
Пример #4
0
def testStewardCannotAddUsersAttribute(nodeSet, looper, steward, stewardWallet,
                                       userIdA, attributeData):
    with whitelistextras("UnauthorizedClientRequest"):
        attrib = Attribute(name='test3 attribute',
                           origin=stewardWallet.defaultId,
                           value=attributeData,
                           dest=userIdA,
                           ledgerStore=LedgerStore.RAW)
        reqs = makeAttribRequest(steward, stewardWallet, attrib)
        timeout = waits.expectedReqNAckQuorumTime()
        looper.run(
            eventually(
                checkRejects,
                steward,
                reqs[0].reqId,
                "UnauthorizedClientRequest('Only identity owner/guardian can add attribute for that identity'",
                retryWait=1,
                timeout=timeout))
Пример #5
0
def testStewardCannotAddUsersAttribute(nodeSet, looper, steward,
                                       stewardWallet, userIdA, attributeData):
    with whitelistextras("UnauthorizedClientRequest"):
        attrib = Attribute(name='test3 attribute',
                           origin=stewardWallet.defaultId,
                           value=attributeData,
                           dest=userIdA,
                           ledgerStore=LedgerStore.RAW)
        reqs = makeAttribRequest(steward, stewardWallet, attrib)
        timeout = waits.expectedReqNAckQuorumTime()
        looper.run(
            eventually(
                checkRejects,
                steward,
                reqs[0].reqId,
                "UnauthorizedClientRequest('Only identity owner/guardian can "
                "add attribute for that identity'",
                retryWait=1,
                timeout=timeout))