def userClientB(nodeSet, userWalletB, looper, tdir): u, _ = genTestClient(nodeSet, tmpdir=tdir, usePoolLedger=True) u.registerObserver(userWalletB.handleIncomingReply) looper.add(u) looper.run(u.ensureConnectedToNodes()) makePendingTxnsRequest(u, userWalletB) return u
def buildStewardClient(looper, tdir, stewardWallet): s, _ = genTestClient(tmpdir=tdir, usePoolLedger=True) s.registerObserver(stewardWallet.handleIncomingReply) looper.add(s) looper.run(s.ensureConnectedToNodes()) makePendingTxnsRequest(s, stewardWallet) return s
def test_attr_with_no_dest_added(nodeSet, tdir, looper, trustAnchor, addedTrustAnchor, attributeData): user_wallet = Wallet() signer = DidSigner() user_wallet.addIdentifier(signer=signer) client, _ = genTestClient(nodeSet, tmpdir=tdir, usePoolLedger=True) client.registerObserver(user_wallet.handleIncomingReply) looper.add(client) looper.run(client.ensureConnectedToNodes()) makePendingTxnsRequest(client, user_wallet) createNym(looper, user_wallet.defaultId, trustAnchor, addedTrustAnchor, role=None, verkey=user_wallet.getVerkey()) attr1 = json.dumps({'age': "24"}) attrib = Attribute(name='test4 attribute', origin=user_wallet.defaultId, value=attr1, dest=None, ledgerStore=LedgerStore.RAW) addAttributeAndCheck(looper, client, user_wallet, attrib)
def trustAnchor(nodeSet, addedTrustAnchor, trustAnchorWallet, looper, tdir): s, _ = genTestClient(nodeSet, tmpdir=tdir, usePoolLedger=True) s.registerObserver(trustAnchorWallet.handleIncomingReply) looper.add(s) looper.run(s.ensureConnectedToNodes()) makePendingTxnsRequest(s, trustAnchorWallet) return s
def client(wallet, looper, tdir): s, _ = genTestClient(tmpdir=tdir, usePoolLedger=True) s.registerObserver(wallet.handleIncomingReply) looper.add(s) looper.run(s.ensureConnectedToNodes()) makePendingTxnsRequest(s, wallet) return s
def nonTrustAnchor(looper, nodeSet, tdir): sseed = b'a secret trust anchor seed......' signer = DidSigner(seed=sseed) c, _ = genTestClient(nodeSet, tmpdir=tdir, usePoolLedger=True) w = Wallet(c.name) w.addIdentifier(signer=signer) c.registerObserver(w.handleIncomingReply) looper.add(c) looper.run(c.ensureConnectedToNodes()) return c, w
def nonTrustAnchor(looper, nodeSet, tdir): sseed = b'a secret trust anchor seed......' signer = SimpleSigner(seed=sseed) c, _ = genTestClient(nodeSet, tmpdir=tdir, usePoolLedger=True) w = Wallet(c.name) w.addIdentifier(signer=signer) c.registerObserver(w.handleIncomingReply) looper.add(c) looper.run(c.ensureConnectedToNodes()) return c, w
def testNonTrustAnchoredNymCanDoGetNym(nodeSet, addedTrustAnchor, trustAnchorWallet, tdir, looper): signer = SimpleSigner() someClient, _ = genTestClient(nodeSet, tmpdir=tdir, usePoolLedger=True) wallet = Wallet(someClient.name) wallet.addIdentifier(signer=signer) someClient.registerObserver(wallet.handleIncomingReply) looper.add(someClient) looper.run(someClient.ensureConnectedToNodes()) needle = trustAnchorWallet.defaultId makeGetNymRequest(someClient, wallet, needle) looper.run(eventually(someClient.hasNym, needle, retryWait=1, timeout=5))
def anotherTrustAnchor(nodeSet, steward, stewardWallet, tdir, looper): sseed = b'1 secret trust anchor seed......' signer = DidSigner(seed=sseed) c, _ = genTestClient(nodeSet, tmpdir=tdir, usePoolLedger=True) w = Wallet(c.name) w.addIdentifier(signer=signer) c.registerObserver(w.handleIncomingReply) looper.add(c) looper.run(c.ensureConnectedToNodes()) createNym(looper, signer.identifier, steward, stewardWallet, role=TRUST_ANCHOR, verkey=signer.verkey) return c, w
def testNonTrustAnchoredNymCanDoGetNym(nodeSet, addedTrustAnchor, trustAnchorWallet, tdir, looper): signer = DidSigner() someClient, _ = genTestClient(nodeSet, tmpdir=tdir, usePoolLedger=True) wallet = Wallet(someClient.name) wallet.addIdentifier(signer=signer) someClient.registerObserver(wallet.handleIncomingReply) looper.add(someClient) looper.run(someClient.ensureConnectedToNodes()) needle = trustAnchorWallet.defaultId makeGetNymRequest(someClient, wallet, needle) timeout = waits.expectedTransactionExecutionTime(len(nodeSet)) looper.run(eventually(someClient.hasNym, needle, retryWait=1, timeout=timeout))
def testGetTxnsSeqNo(nodeSet, addedTrustAnchor, tdir, trustAnchorWallet, looper): """ Test GET_TXNS from client and provide seqNo to fetch from """ trustAnchor = genTestClient(nodeSet, tmpdir=tdir, usePoolLedger=True) looper.add(trustAnchor) looper.run(trustAnchor.ensureConnectedToNodes()) def chk(): assert trustAnchor.spylog.count(trustAnchor.requestPendingTxns.__name__) > 0 looper.run(eventually(chk, retryWait=1, timeout=3))
def testGetTxnsSeqNo(nodeSet, addedTrustAnchor, tdir, trustAnchorWallet, looper): """ Test GET_TXNS from client and provide seqNo to fetch from """ trustAnchor = genTestClient(nodeSet, tmpdir=tdir, usePoolLedger=True) looper.add(trustAnchor) looper.run(trustAnchor.ensureConnectedToNodes()) def chk(): assert trustAnchor.spylog.count(trustAnchor.requestPendingTxns.__name__) > 0 # TODO choose or create timeout in 'waits' on this case. looper.run(eventually(chk, retryWait=1, timeout=3))
def clientAndWallet1(client1Signer, looper, nodeSet, tdir, up): client, wallet = genTestClient(nodeSet, tmpdir=tdir, usePoolLedger=True) wallet = Wallet(client.name) wallet.addIdentifier(signer=client1Signer) return client, wallet