Ejemplo n.º 1
0
def step_impl(context, agent_name, schema_name):
    agent = context.active_agents[agent_name]

    schema_info = read_schema_data(schema_name)
    connection_id = agent["agent"].agent.connection_id

    created_txn = agent_container_POST(
        agent["agent"],
        "/schemas",
        data=schema_info["schema"],
        params={
            "conn_id": connection_id,
            "create_transaction_for_endorser": "true"
        },
    )

    # assert goodness
    if agent["agent"].endorser_role and agent[
            "agent"].endorser_role == "author":
        assert created_txn["txn"]["state"] == "request_sent"
    else:
        assert created_txn["txn"]["state"] == "transaction_created"

    if not "txn_ids" in context:
        context.txn_ids = {}
    context.txn_ids["AUTHOR"] = created_txn["txn"]["transaction_id"]
Ejemplo n.º 2
0
def step_impl(context, agent_name, schema_name):
    agent = context.active_agents[agent_name]

    schema_info = read_schema_data(schema_name)

    schemas = agent_container_GET(agent["agent"], "/schemas/created")
    assert len(schemas["schema_ids"]) == 1

    schema_id = schemas["schema_ids"][0]
    schema = agent_container_GET(agent["agent"], "/schemas/" + schema_id)
def step_impl(context, issuer, schema_name):
    agent = context.active_agents[issuer]

    schema_info = read_schema_data(schema_name)
    cred_def_id = aries_container_create_schema_cred_def(
        agent["agent"],
        schema_info["schema"]["schema_name"],
        schema_info["schema"]["attributes"],
        version=schema_info["schema"]["schema_version"],
    )

    context.schema_name = schema_name
    context.cred_def_id = cred_def_id
Ejemplo n.º 4
0
def step_impl(context, agent_name, schema_name):
    agent = context.active_agents[agent_name]

    schema_info = read_schema_data(schema_name)

    cred_defs = agent_container_GET(agent["agent"],
                                    "/credential-definitions/created")
    assert len(cred_defs["credential_definition_ids"]) == 1

    cred_def_id = cred_defs["credential_definition_ids"][0]
    cred_def = agent_container_GET(agent["agent"],
                                   "/credential-definitions/" + cred_def_id)

    context.cred_def_id = cred_def_id
Ejemplo n.º 5
0
def step_impl(context, agent_name, schema_name):
    agent = context.active_agents[agent_name]

    schema_info = read_schema_data(schema_name)

    schemas = {"schema_ids": []}
    i = 5
    while 0 == len(schemas["schema_ids"]) and i > 0:
        async_sleep(1.0)
        schemas = agent_container_GET(agent["agent"], "/schemas/created")
        i = i - 1
    assert len(schemas["schema_ids"]) == 1

    schema_id = schemas["schema_ids"][0]
    schema = agent_container_GET(agent["agent"], "/schemas/" + schema_id)

    context.schema_name = schema_name
Ejemplo n.º 6
0
def step_impl(context, agent_name, schema_name):
    agent = context.active_agents[agent_name]

    schema_info = read_schema_data(schema_name)

    cred_defs = {"credential_definition_ids": []}
    i = 5
    while 0 == len(cred_defs["credential_definition_ids"]) and i > 0:
        async_sleep(1.0)
        cred_defs = agent_container_GET(agent["agent"],
                                        "/credential-definitions/created")
        i = i - 1
    assert len(cred_defs["credential_definition_ids"]) == 1

    cred_def_id = cred_defs["credential_definition_ids"][0]
    cred_def = agent_container_GET(agent["agent"],
                                   "/credential-definitions/" + cred_def_id)

    context.cred_def_id = cred_def_id
def step_impl(context, issuer, schema_name):
    agent = context.active_agents[issuer]

    schema_info = read_schema_data(schema_name)
    cred_def_id = aries_container_create_schema_cred_def(
        agent["agent"],
        schema_info["schema"]["schema_name"],
        schema_info["schema"]["attributes"],
        version=schema_info["schema"]["schema_version"],
    )

    # confirm the cred def was actually created
    async_sleep(2.0)
    cred_def_saved = agent_container_GET(
        agent["agent"], "/credential-definitions/" + cred_def_id)
    assert cred_def_saved

    context.schema_name = schema_name
    context.cred_def_id = cred_def_id
Ejemplo n.º 8
0
def step_impl(context, agent_name, schema_name):
    agent = context.active_agents[agent_name]

    schema_info = read_schema_data(schema_name)
    endorser_did = context.public_dids["ENDORSER"]
    created_txn = agent_container_POST(
        agent["agent"],
        "/schemas",
        data=schema_info["schema"],
        params={
            "auto_endorse": "false",
            "endorser_did": endorser_did
        },
    )

    # assert goodness
    assert created_txn["state"] == "transaction_created"
    if not "txn_ids" in context:
        context.txn_ids = {}
    context.txn_ids["AUTHOR"] = created_txn["_id"]