Beispiel #1
0
def sponsorWithAgentScenario(keySharedNodes, looper, tdir):
    s = Scenario(nodeSet=keySharedNodes, looper=looper, tmpdir=tdir)
    s.addAgent()
    s.addSponsor()
    s.actor = s.sponsor
    s.run(setupAndStart)
    return s
Beispiel #2
0
def testSponsorRegistersUserUsingAgentApi(nodeSet, looper, tdir):
    # Sponsor not on the blockchain, but is using an Agent's API
    with Scenario(nodeSet=nodeSet, looper=looper, tmpdir=tdir) as s:
        # TODO: Should the `Agent` class be used here? Or should `Organization` have a webserver?.
        # TODO: Need a webserver which is running on the agent
        s.addAgent()
        s.actor = s.agent
Beispiel #3
0
async def setupAndStart(s: Scenario):
    # TODO: Should be an api call. But to which server does the api call go to?
    # Do we create a new server for the api?

    # Wallet is created by the Agent one time, but cryptonyms can be
    # created many times. The agent provides the cyptonym to the Sponsor
    s.agentNym = s.agent.wallet.newCryptonym() if s.agent else None
    s.sponsorNym = s.sponsor.wallet.newCryptonym() if s.agent else None

    # Created by the Sponsor on behalf of the member
    s.userId = "Ravi"
    s.actor.createUserWallet(s.userId)
    s.userNym = s.actor.getUserWallet(s.userId).newCryptonym()
    s.actor.getUserWallet(s.userId).addAgent(s.agentNym)

    await s.start()
    await s.startClient()