From b68cc4c9575b1f4559af8f316b7f2a4a56af817a Mon Sep 17 00:00:00 2001 From: Vinay Bhardwaj <vinay.bhardwaj@ayanworks.com> Date: Thu, 9 Jun 2022 12:59:32 +0000 Subject: [PATCH] Added BDDs for Attestation Manager --- .../credentialDef/createCredentialDef.feature | 26 +++++++++++++++++++ .../credentialDef/findCredentialDef.feature | 17 ++++++++++++ .../findCredentialDefById.feature | 17 ++++++++++++ .../acceptOfferCredential.feature | 12 +++++++++ .../createCredentialType.feature | 18 +++++++++++++ .../createOfferCredential.feature | 12 +++++++++ .../issue-credential/getCredential.feature | 16 ++++++++++++ .../getCredentialsTypeDetails.feature | 11 ++++++++ .../getIssuedCredentials.feature | 10 +++++++ .../offerMemberShipCredentials.feature | 12 +++++++++ .../updateSchemaIdByType.feature | 12 +++++++++ .../webHookCredentials.feature | 19 ++++++++++++++ .../schemas/createSchema.feature | 26 +++++++++++++++++++ .../schemas/findSchemaById.feature | 17 ++++++++++++ .../schemas/findSchemas.feature | 11 ++++++++ .../schemas/getDidsForSchema.feature | 17 ++++++++++++ 16 files changed, 253 insertions(+) create mode 100644 features/attestation-manager/credentialDef/createCredentialDef.feature create mode 100644 features/attestation-manager/credentialDef/findCredentialDef.feature create mode 100644 features/attestation-manager/credentialDef/findCredentialDefById.feature create mode 100644 features/attestation-manager/issue-credential/acceptOfferCredential.feature create mode 100644 features/attestation-manager/issue-credential/createCredentialType.feature create mode 100644 features/attestation-manager/issue-credential/createOfferCredential.feature create mode 100644 features/attestation-manager/issue-credential/getCredential.feature create mode 100644 features/attestation-manager/issue-credential/getCredentialsTypeDetails.feature create mode 100644 features/attestation-manager/issue-credential/getIssuedCredentials.feature create mode 100644 features/attestation-manager/issue-credential/offerMemberShipCredentials.feature create mode 100644 features/attestation-manager/issue-credential/updateSchemaIdByType.feature create mode 100644 features/attestation-manager/issue-credential/webHookCredentials.feature create mode 100644 features/attestation-manager/schemas/createSchema.feature create mode 100644 features/attestation-manager/schemas/findSchemaById.feature create mode 100644 features/attestation-manager/schemas/findSchemas.feature create mode 100644 features/attestation-manager/schemas/getDidsForSchema.feature diff --git a/features/attestation-manager/credentialDef/createCredentialDef.feature b/features/attestation-manager/credentialDef/createCredentialDef.feature new file mode 100644 index 0000000..9f8a9c0 --- /dev/null +++ b/features/attestation-manager/credentialDef/createCredentialDef.feature @@ -0,0 +1,26 @@ +As an OCM user + I want to create a new Credential Definition + +Feature: Create a new Credential Definition + Create a new Credential Definition on Ledger and save details in DB + + Scenario: Provide valid and required Credential Definition Details + Given I have passed all required credential definition details. + # src\credentialDef\controller\controller.ts -> REST API with POST method -> credentialDef/ + When passed all valid credential definition details. + Then credential definition should be created on the Ledger with the given details. + And should return the newly created credential definition id. + And store the details in DB. + And I should get the HTTP status code 201 Created and the created Credential Definition Details. + + Scenario: Provide invalid schemaID, name, created_by, is_revokable or is_auto_issue + Given I have passed schemaID, name, created_by, is_revokable and is_auto_issue. + # src\credentialDef\controller\controller.ts -> REST API with POST method -> credentialDef/ + When passed invalid schemaID, name, created_by, is_revokable or is_auto_issue. + Then I should get HTTP status code 400 Bad Request. + + Scenario: Provide name and schemaID of the existing Credential Definition. + Given I have passed all required credential definition details. + # src\credentialDef\controller\controller.ts -> REST API with POST method -> credentialDef/ + When passed name and schemaID of the existing Credential Definition. + Then I should get HTTP status code 409 Conflict. \ No newline at end of file diff --git a/features/attestation-manager/credentialDef/findCredentialDef.feature b/features/attestation-manager/credentialDef/findCredentialDef.feature new file mode 100644 index 0000000..5dac4c1 --- /dev/null +++ b/features/attestation-manager/credentialDef/findCredentialDef.feature @@ -0,0 +1,17 @@ +As an OCM user + I want to get all Credential Definitions by schema id + +Feature: Get All Credential Definitions by schema id + Get All Credential Definitions from the DB by given schema id + + Scenario: Provide valid schema id, page and page size. + Given I have passed the required schema id, page and page size. + # src\credentialDef\controller\controller.ts -> REST API with GET method -> credentialDef/ + When passed details are valid. + Then I should get the HTTP status code 200 Ok and list of Credential Definitions from the DB. + + Scenario: Provide invalid schema id. + Given I have passed the required schema id. + # src\credentialDef\controller\controller.ts -> REST API with GET method -> credentialDef/ + When passed schema id is invalid. + Then I should get the HTTP status code 404 NOT Found. \ No newline at end of file diff --git a/features/attestation-manager/credentialDef/findCredentialDefById.feature b/features/attestation-manager/credentialDef/findCredentialDefById.feature new file mode 100644 index 0000000..270c148 --- /dev/null +++ b/features/attestation-manager/credentialDef/findCredentialDefById.feature @@ -0,0 +1,17 @@ +As an OCM user + I want to find Credential Definition by id + +Feature: Get Credential Definition by Id + Get Credential Definition by the given cred_def_id + + Scenario: Provide valid cred_def_id. + Given I have passed the required cred_def_id. + # src\credentialDef\controller\controller.ts -> REST API with GET method -> credentialDef/:id + When passed cred_def_id is valid. + Then I should get the HTTP status code 200 Ok and Credential Definition from the DB. + + Scenario: Provide invalid cred_def_id. + Given I have passed the required cred_def_id. + # src\credentialDef\controller\controller.ts -> REST API with GET method -> credentialDef/:id + When passed cred_def_id is invalid. + Then I should get the HTTP status code 404 Not Found. diff --git a/features/attestation-manager/issue-credential/acceptOfferCredential.feature b/features/attestation-manager/issue-credential/acceptOfferCredential.feature new file mode 100644 index 0000000..a30ce0d --- /dev/null +++ b/features/attestation-manager/issue-credential/acceptOfferCredential.feature @@ -0,0 +1,12 @@ +As an OCM user + I want to accept a credential offer + +Feature: Accept offer credential + Accept a credential offer + + Scenario: Provide valid and required credentialId + Given I have passed all required details. + # src\issue-credential\controller\controller.ts -> REST API with POST method -> accept-request/ + When passed all valid accept offer credential details. + Then credential offer should get accepted. + And I should get the HTTP status code 202 Accepted and the updated credential offer Details. \ No newline at end of file diff --git a/features/attestation-manager/issue-credential/createCredentialType.feature b/features/attestation-manager/issue-credential/createCredentialType.feature new file mode 100644 index 0000000..2231f0a --- /dev/null +++ b/features/attestation-manager/issue-credential/createCredentialType.feature @@ -0,0 +1,18 @@ +As an OCM user + I want to create a new CredentialType + +Feature: Create a new CredentialType + Create a new CredentialType + + Scenario: Provide valid and required CredentialType Details + Given I have passed all required credentialType details. + # src\issue-credential\controller\controller.ts -> REST API with POST method -> credentialType/ + When passed all valid credentialType details. + Then credentialType should be created in DB. + And I should get the HTTP status code 201 Created and the created CredentialType Details. + + Scenario: Provide invalid schema_id or type + Given I have passed schema_id and type. + # src\issue-credential\controller\controller.ts -> REST API with POST method -> credentialType/ + When passed invalid schema_id or type. + Then I should get HTTP status code 400 Bad Request. \ No newline at end of file diff --git a/features/attestation-manager/issue-credential/createOfferCredential.feature b/features/attestation-manager/issue-credential/createOfferCredential.feature new file mode 100644 index 0000000..4354f25 --- /dev/null +++ b/features/attestation-manager/issue-credential/createOfferCredential.feature @@ -0,0 +1,12 @@ +As an OCM user + I want to create credential offer + +Feature: Create offer credential + Create a credential offer + + Scenario: Provide valid and required connectionId, credentialDefinitionId, comment, preview and autoAcceptCredential + Given I have passed all required offer credential details. + # src\issue-credential\controller\controller.ts -> REST API with POST method -> create-offer-credential/ + When passed all valid offer credential details. + Then credential offer should be sent to the given connection. + And I should get the HTTP status code 201 Created and the created credential offer Details. \ No newline at end of file diff --git a/features/attestation-manager/issue-credential/getCredential.feature b/features/attestation-manager/issue-credential/getCredential.feature new file mode 100644 index 0000000..9f503d9 --- /dev/null +++ b/features/attestation-manager/issue-credential/getCredential.feature @@ -0,0 +1,16 @@ +As an OCM user + I want to get credentials + +Feature: Get credential + + Scenario: Provide valid credential_id + Given I have passed all required details. + # src\issue-credential\controller\controller.ts -> REST API with POST method -> credential/:id + When passed valid credential_id. + Then I should get the HTTP status code 200 Ok and the credential Details. + + Scenario: Provide invalid credential_id + Given I have passed all required details. + # src\issue-credential\controller\controller.ts -> REST API with POST method -> credential/:id + When passed invalid credential_id. + Then I should get the HTTP status code 404 Not Found. \ No newline at end of file diff --git a/features/attestation-manager/issue-credential/getCredentialsTypeDetails.feature b/features/attestation-manager/issue-credential/getCredentialsTypeDetails.feature new file mode 100644 index 0000000..5c832c4 --- /dev/null +++ b/features/attestation-manager/issue-credential/getCredentialsTypeDetails.feature @@ -0,0 +1,11 @@ +As an OCM user + I want to get the credentialType details of a given type + +Feature: Get CredentialType details + Get the details of credentialType of given type + + Scenario: Provide valid and required type + Given I have passed type. + # src\issue-credential\controller\controller.ts -> NATS call for topic 'ATTESTATION_MANAGER_SERVICE/getCredentialsTypeDetails' + When passed valid type. + Then I should get the details of the CredentialType. \ No newline at end of file diff --git a/features/attestation-manager/issue-credential/getIssuedCredentials.feature b/features/attestation-manager/issue-credential/getIssuedCredentials.feature new file mode 100644 index 0000000..18e4260 --- /dev/null +++ b/features/attestation-manager/issue-credential/getIssuedCredentials.feature @@ -0,0 +1,10 @@ +As an OCM user + I want to get the credentials issued to a given connection + +Feature: Get issued credentials of a given connection + + Scenario: Provide valid and required connection_id + Given I have passed connection_id. + # src\issue-credential\controller\controller.ts -> NATS call for topic 'ATTESTATION_MANAGER_SERVICE/getIssueCredentials' + When passed valid connection_id. + Then I should get the list of Credentials Issued. \ No newline at end of file diff --git a/features/attestation-manager/issue-credential/offerMemberShipCredentials.feature b/features/attestation-manager/issue-credential/offerMemberShipCredentials.feature new file mode 100644 index 0000000..96a06ff --- /dev/null +++ b/features/attestation-manager/issue-credential/offerMemberShipCredentials.feature @@ -0,0 +1,12 @@ +As an OCM user + I want to offer MemberShip Credentials + +Feature: Offer Membership Credential + Offer a membership credential to User + + Scenario: Provide valid and required status, connectionId, theirLabel and participantDid + Given AFJ Agent NATS Publisher have passed all required offer membership credential details. + # src\issue-credential\controller\controller.ts -> NATS call for topic 'ATTESTATION_MANAGER_SERVICE/offerMemberShipCredentials' + When passed all valid offer membership credential details. + Then credential offer should be sent to the given connection. + And I should get the HTTP status code 201 Created and the created membership credential offer Details. \ No newline at end of file diff --git a/features/attestation-manager/issue-credential/updateSchemaIdByType.feature b/features/attestation-manager/issue-credential/updateSchemaIdByType.feature new file mode 100644 index 0000000..8a5fa42 --- /dev/null +++ b/features/attestation-manager/issue-credential/updateSchemaIdByType.feature @@ -0,0 +1,12 @@ +As an OCM user + I want to update schema_id in credentialType of given type + +Feature: Update schema_id by type + update schema_id in credentialType for given type + + Scenario: Provide valid and required schema_id and type + Given I have passed all required details. + # src\issue-credential\controller\controller.ts -> REST API with POST method -> updateSchemaIdByType/ + When passed valid schema_id and type. + Then credentialType should be updated. + And I should get the HTTP status code 200 Ok and the updated credentialType Details. \ No newline at end of file diff --git a/features/attestation-manager/issue-credential/webHookCredentials.feature b/features/attestation-manager/issue-credential/webHookCredentials.feature new file mode 100644 index 0000000..97102b2 --- /dev/null +++ b/features/attestation-manager/issue-credential/webHookCredentials.feature @@ -0,0 +1,19 @@ +As an OCM user + I want to save the credential details from Webhook emitted by AFJ Agent + +Feature: Credentials Webhook + Credential Webhook Emitted by AFJ + + Scenario: A new Credential is offered + Given AFJ Agent have passed created credential details. + # src\issue-credential\controller\controller.ts -> NATS call for topic 'ATTESTATION_MANAGER_SERVICE/CredentialStateChanged' + When passed credential state is OFFER_SENT. + Then credential should be created in DB. + And I should get the HTTP status code 201 Created and the created credential Details. + + Scenario: A Credential's state is changed + Given AFJ have passed the updated credential details. + # src\issue-credential\controller\controller.ts -> NATS call for topic 'ATTESTATION_MANAGER_SERVICE/CredentialStateChanged' + When passed credential state is not OFFER_SENT. + Then credential state should be updated in DB. + And I should get the HTTP status code 202 Accepted and the updated credential Details. diff --git a/features/attestation-manager/schemas/createSchema.feature b/features/attestation-manager/schemas/createSchema.feature new file mode 100644 index 0000000..c847dc7 --- /dev/null +++ b/features/attestation-manager/schemas/createSchema.feature @@ -0,0 +1,26 @@ +As an OCM user + I want to create a new Schema + +Feature: Create a new Schema + Create a new Schema on Ledger and save details in DB + + Scenario: Provide valid and required Schema Details + Given I have passed all required schema details. + # src\schemas\controller\controller.ts -> REST API with POST method -> schemas/ + When passed all valid schema details. + Then schema should be created on the Ledger with the given details. + And should return the newly created Schema_ID. + And store the details in DB. + And I should get the HTTP status code 201 Created and the created Schema Details. + + Scenario: Provide invalid name, created_by, version or attributes + Given I have passed name, created_by, version and attributes. + # src\schemas\controller\controller.ts -> REST API with POST method -> schemas/ + When passed invalid name, created_by, version or attributes. + Then I should get the HTTP status code 400 Bad Request. + + Scenario: Provide name and version of the existing Schema. + Given I have passed all required schema details. + # src\schemas\controller\controller.ts -> REST API with POST method -> schemas/ + When passed name and version of the existing Schema. + Then I should get the HTTP status code 409 Conflict. \ No newline at end of file diff --git a/features/attestation-manager/schemas/findSchemaById.feature b/features/attestation-manager/schemas/findSchemaById.feature new file mode 100644 index 0000000..51cdb9b --- /dev/null +++ b/features/attestation-manager/schemas/findSchemaById.feature @@ -0,0 +1,17 @@ +As an OCM user + I want to get the Schema by id + +Feature: Get Schema by Id + Get Schema by the given schema id + + Scenario: Provide valid schema id. + Given I have passed the required schema id. + # src\schemas\controller\controller.ts -> REST API with GET method -> schemas/:id + When passed schema id is valid. + Then I should get the HTTP status code 200 Ok and Schema from the DB. + + Scenario: Provide invalid schema id. + Given I have passed the required schema id. + # src\schemas\controller\controller.ts -> REST API with GET method -> schemas/:id + When passed schema id is invalid. + Then I should get the HTTP status code 404 Not Found. diff --git a/features/attestation-manager/schemas/findSchemas.feature b/features/attestation-manager/schemas/findSchemas.feature new file mode 100644 index 0000000..384c8c8 --- /dev/null +++ b/features/attestation-manager/schemas/findSchemas.feature @@ -0,0 +1,11 @@ +As an OCM user + I want to get list of all the Schemas + +Feature: Get All Schemas + Get All Schemas from the DB + + Scenario: Provide valid page and page size. + Given I have passed the required page and page size. + # src\schemas\controller\controller.ts -> REST API with GET method -> schemas/ + When passed details are valid. + Then I should get the HTTP status code 200 Ok and list of Schemas from the DB. \ No newline at end of file diff --git a/features/attestation-manager/schemas/getDidsForSchema.feature b/features/attestation-manager/schemas/getDidsForSchema.feature new file mode 100644 index 0000000..55aebf6 --- /dev/null +++ b/features/attestation-manager/schemas/getDidsForSchema.feature @@ -0,0 +1,17 @@ +As an OCM user + I want to get all principal DIDs for a given schema id + +Feature: Get all DIDs for Schema + Get all principal DIDs for a given schema id + + Scenario: Provide valid schema id. + Given I have passed the required schema id. + # src\schemas\controller\controller.ts -> REST API with GET method -> get-dids-for-schema/:id + When passed schema id is valid. + Then I should get the HTTP status code 200 Ok and Schema DIDs from the DB. + + Scenario: Provide invalid schema id. + Given I have passed the required schema id. + # src\schemas\controller\controller.ts -> REST API with GET method -> get-dids-for-schema/:id + When passed schema id is invalid. + Then I should get the HTTP status code 404 Not Found. \ No newline at end of file -- GitLab