diff --git a/demo/features/0586-sign-transaction.feature b/demo/features/0586-sign-transaction.feature index 7b71fcf6d9..b887539f17 100644 --- a/demo/features/0586-sign-transaction.feature +++ b/demo/features/0586-sign-transaction.feature @@ -50,7 +50,7 @@ Feature: RFC 0586 Aries sign (endorse) transactions functions @T002-RFC0586 - Scenario Outline: endorse a schema and cred def transaction, write to the ledger, issue and revoke a credential + Scenario Outline: endorse a schema and cred def transaction, write to the ledger, issue and revoke a credential, manually invoking each endorsement endpoint Given we have "2" agents | name | role | capabilities | | Acme | endorser | | @@ -96,3 +96,30 @@ Feature: RFC 0586 Aries sign (endorse) transactions functions # | --revocation --public-did --mediation | --revocation --mediation | driverslicense | Data_DL_NormalizedValues | # | --revocation --public-did --multitenant | --revocation --multitenant | driverslicense | Data_DL_NormalizedValues | # | --revocation --public-did --mediation --multitenant | --revocation --mediation --multitenant | driverslicense | Data_DL_NormalizedValues | + + @T003-RFC0586 + Scenario Outline: endorse a schema and cred def transaction, write to the ledger, issue and revoke a credential, with auto endorsing workflow + Given we have "2" agents + | name | role | capabilities | + | Acme | endorser | | + | Bob | author | | + And "Acme" and "Bob" have an existing connection + When "Acme" has a DID with role "ENDORSER" + And "Bob" has a DID with role "AUTHOR" + And "Acme" connection has job role "TRANSACTION_ENDORSER" + And "Bob" connection has job role "TRANSACTION_AUTHOR" + And "Bob" connection sets endorser info + And "Bob" authors a schema transaction with + And "Bob" has written the schema to the ledger + And "Bob" authors a credential definition transaction with + And "Bob" has written the credential definition for to the ledger + And "Bob" has written the revocation registry definition to the ledger + And "Bob" has written the revocation registry entry transaction to the ledger + And "Acme" has an issued credential from "Bob" + And "Bob" revokes the credential without publishing the entry + And "Bob" authors a revocation registry entry publishing transaction + Then "Acme" can verify the credential from "Bob" was revoked + + Examples: + | Acme_capabilities | Bob_capabilities | Schema_name | Credential_data | + | --endorser-role endorser --revocation --public-did | --endorser-role author --revocation | driverslicense | Data_DL_NormalizedValues | diff --git a/demo/features/steps/0586-sign-transaction.py b/demo/features/steps/0586-sign-transaction.py index dec9a51c52..bc9133699b 100644 --- a/demo/features/steps/0586-sign-transaction.py +++ b/demo/features/steps/0586-sign-transaction.py @@ -99,7 +99,11 @@ def step_impl(context, agent_name, schema_name): ) # assert goodness - assert created_txn["txn"]["state"] == "transaction_created" + 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"] @@ -175,7 +179,12 @@ def step_impl(context, agent_name, schema_name): schema_info = read_schema_data(schema_name) - schemas = agent_container_GET(agent["agent"], "/schemas/created") + 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] @@ -211,7 +220,10 @@ def step_impl(context, agent_name, schema_name): ) # assert goodness - assert created_txn["txn"]["state"] == "transaction_created" + 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"] @@ -228,7 +240,14 @@ def step_impl(context, agent_name, schema_name): schema_info = read_schema_data(schema_name) - cred_defs = agent_container_GET(agent["agent"], "/credential-definitions/created") + 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] @@ -293,13 +312,18 @@ def step_impl(context, agent_name, schema_name): def step_impl(context, agent_name): agent = context.active_agents[agent_name] - rev_regs = agent_container_GET( - agent["agent"], - "/revocation/registries/created", - params={ - "cred_def_id": context.cred_def_id, - }, - ) + rev_regs = {"rev_reg_ids": []} + i = 5 + while 0 == len(rev_regs["rev_reg_ids"]) and i > 0: + async_sleep(1.0) + rev_regs = agent_container_GET( + agent["agent"], + "/revocation/registries/created", + params={ + "cred_def_id": context.cred_def_id, + }, + ) + i = i - 1 assert len(rev_regs["rev_reg_ids"]) == 1 rev_reg_id = rev_regs["rev_reg_ids"][0] @@ -333,6 +357,19 @@ def step_impl(context, agent_name): ) +@when( + '"{agent_name}" has written the revocation registry entry transaction to the ledger' +) +@then( + '"{agent_name}" has written the revocation registry entry transaction to the ledger' +) +def step_impl(context, agent_name): + agent = context.active_agents[agent_name] + + # TODO not sure what to check here, let's just do a short pause + async_sleep(2.0) + + @when( '"{agent_name}" authors a revocation registry entry transaction for the credential definition matching {schema_name}' ) @@ -430,7 +467,11 @@ def step_impl(context, agent_name): "create_transaction_for_endorser": "true", }, ) - assert created_txn["txn"]["state"] == "transaction_created" + + 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"] @@ -440,6 +481,9 @@ def step_impl(context, agent_name): def step_impl(context, holder_name, issuer_name): agent = context.active_agents[holder_name] + # sleep here to allow the auto-endorser process to complete + async_sleep(2.0) + # fetch the credential - there only is one in the wallet cred_list = agent_container_GET( agent["agent"],