From 341f9d06d293ff5a1d96fb48a1b58c6fdc9c5a39 Mon Sep 17 00:00:00 2001
From: Shridhar Honmore <shridhar.honmore@ayanworks.com>
Date: Thu, 19 May 2022 16:39:28 +0530
Subject: [PATCH] Proof Manager BDD

---
 features/proof/acceptPresentation.feature     | 16 +++++++
 .../proof/findProofByPresentationId.feature   | 17 +++++++
 features/proof/findProofPresentation.feature  | 20 +++++++++
 .../sendOutOfBandPresentationRequest.feature  | 38 ++++++++++++++++
 .../proof/sendPresentationRequest.feature     | 45 +++++++++++++++++++
 ...cipalCredentialPresentationRequest.feature | 38 ++++++++++++++++
 .../proof/webhookCallForUpdateStatus.feature  | 22 +++++++++
 7 files changed, 196 insertions(+)
 create mode 100644 features/proof/acceptPresentation.feature
 create mode 100644 features/proof/findProofByPresentationId.feature
 create mode 100644 features/proof/findProofPresentation.feature
 create mode 100644 features/proof/sendOutOfBandPresentationRequest.feature
 create mode 100644 features/proof/sendPresentationRequest.feature
 create mode 100644 features/proof/sendPrincipalCredentialPresentationRequest.feature
 create mode 100644 features/proof/webhookCallForUpdateStatus.feature

diff --git a/features/proof/acceptPresentation.feature b/features/proof/acceptPresentation.feature
new file mode 100644
index 0000000..49dc8bd
--- /dev/null
+++ b/features/proof/acceptPresentation.feature
@@ -0,0 +1,16 @@
+Feature: Accept Presentation Request
+         I will recive the presentation request from PCM user.
+
+Scenario: Accept Presentation Request
+    Given I have passed presentation id.
+    When  I pass valid presentation id.
+    Then  should accept the presentation request with status code 200.
+
+Scenario: Accept Presentation Request
+    Given I have passed presentation id.
+    When  I pass invalid presentation id.
+    Then  should return the status code 400.
+
+Scenario: Accept Presentation Request
+    Given I have not passed presentation id.
+    Then  should return Accept presentation request required following attributes ( presentation_id ).
\ No newline at end of file
diff --git a/features/proof/findProofByPresentationId.feature b/features/proof/findProofByPresentationId.feature
new file mode 100644
index 0000000..587e84f
--- /dev/null
+++ b/features/proof/findProofByPresentationId.feature
@@ -0,0 +1,17 @@
+Feature: Get Proof Presentation By Id
+        Return the single proof presentation details
+
+Scenario: Provide valid presentation id
+    Given The presentation id is available on agent database.
+    When  provide valid presentation id.
+    Then  should return proof presentation details.
+
+Scenario: Provide invalid presentation id
+    Given The presentation id available.
+    When  provide invalid presentation id.
+    Then  should return no data found with status code 404.
+
+Scenario: Not provide a presentation id
+    Given The presentation id available.
+    When  not provide presentation id.
+    Then  should return presentation request required following attributes ( presentation_id ) with status code 400.
\ No newline at end of file
diff --git a/features/proof/findProofPresentation.feature b/features/proof/findProofPresentation.feature
new file mode 100644
index 0000000..8eff447
--- /dev/null
+++ b/features/proof/findProofPresentation.feature
@@ -0,0 +1,20 @@
+Feature: Get Proof Presentation
+          Return the list of proof presentation created on OCM environment
+
+Scenario: Provide validated page and pageSize
+    Given proof presentation data available on OCM database. 
+    When  passed valid page.
+    And   passed valid pageSize.
+    Then  should get proof presentation list.
+
+Scenario: Provide validated page and pageSize
+    Given proof presentation data is not available on OCM database.
+    When  passed valid page.
+    And   passed valid pageSize.
+    Then  should get http status 404.
+
+Scenario: Provide invalid page and pageSize
+    Given proof presentation data available on OCM database.
+    When  passed invalid page.
+    And   passed invalid pageSize.
+    Then  should return no data available with http status 404.
\ No newline at end of file
diff --git a/features/proof/sendOutOfBandPresentationRequest.feature b/features/proof/sendOutOfBandPresentationRequest.feature
new file mode 100644
index 0000000..71b716e
--- /dev/null
+++ b/features/proof/sendOutOfBandPresentationRequest.feature
@@ -0,0 +1,38 @@
+Feature: Send Out Of Band Presentation Request
+         I want to verify user credentials.
+
+Scenario: Send Out Of Band Presentation Request
+    Given I have passed all the required proof presentation details.
+    When  I have passed all invalid proof presentation details.
+    Then  should return the presentation request required following attributes ( attributes, schemaId or credentialDefId ).
+
+Scenario: Send Out Of Band Presentation Request
+    Given I have passed credential_def_id.
+    When  I pass invalid credential_def_id.
+    Then  should return the 400 status code.
+
+Scenario: Send Out Of Band Presentation Request
+    Given I have passed attributes.
+    When  I pass invalid attributes.
+    Then  should return the 400 status code.
+
+Scenario: Send Out Of Band Presentation Request
+    Given I have passed attributes and credential_def_id.
+    When  I pass valid attributes.
+    And   I pass valid credential_def_id.
+    Then  should return the 400 status code.
+
+Scenario: Send Out Of Band Presentation Request
+    Given I have passed attributes and credential_def_id.
+    When  I pass valid attributes.
+    And   I pass invalid credential_def_id.
+    Then  should return the 400 status code.
+
+Scenario: Send Out Of Band Presentation Request0
+    Given I have passed all the required proof presentation credential_def_id and attributes.
+    When  I have passed all valid proof presentation details i.e credential_def_id and attributes.
+    Then  the proof presentation request sent to the holder with provided attributes.
+    And   should return presentation id
+    And   store presentation id, status, their_did into OCM database.
+    And   should return the valid status code 201.
+
diff --git a/features/proof/sendPresentationRequest.feature b/features/proof/sendPresentationRequest.feature
new file mode 100644
index 0000000..ec82b45
--- /dev/null
+++ b/features/proof/sendPresentationRequest.feature
@@ -0,0 +1,45 @@
+Feature: Send Presentation Request
+         I want to verify user credentials.
+
+Scenario: Send Presentation Request
+    Given I have passed all the required proof presentation details.
+    When  I have passed all invalid proof presentation details.
+    Then  should return the presentation request required following attributes ( connectionId, attributes, schemaId or credentialDefId ).
+
+Scenario: Send Presentation Request
+    Given I have passed credential_def_id.
+    When  I pass invalid credential_def_id.
+    Then  should return the 400 status code.
+
+Scenario: Send Presentation Request
+    Given I have passed connectionId.
+    When  I pass invalid connectionId.
+    Then  should return the 400 status code.
+
+Scenario: Send Presentation Request
+    Given I have passed attributes.
+    When  I pass invalid attributes.
+    Then  should return the 400 status code.
+
+Scenario: Send Presentation Request
+    Given I have passed connectionId, attributes and credential_def_id.
+    When  I pass valid attributes.
+    And   I pass valid credential_def_id.
+    And   I pass invalid connectionId.
+    Then  should return the 400 status code.
+
+Scenario: Send Presentation Request
+    Given I have passed connectionId, attributes and credential_def_id.
+    When  I pass valid attributes.
+    And   I pass invalid credential_def_id.
+    And   I pass valid connectionId.
+    Then  should return the 400 status code.
+
+Scenario: Send Presentation Request
+    Given I have passed all the required proof presentation credential_def_id, connectionId and attributes.
+    When  I have passed all valid proof presentation details i.e credential_def_id, connectionId and attributes.
+    Then  the proof presentation request sent to the holder with provided attributes.
+    And   should return presentation id
+    And   store presentation id, status, their_did into OCM database.
+    And   should return the valid status code 201.
+
diff --git a/features/proof/sendPrincipalCredentialPresentationRequest.feature b/features/proof/sendPrincipalCredentialPresentationRequest.feature
new file mode 100644
index 0000000..e12676c
--- /dev/null
+++ b/features/proof/sendPrincipalCredentialPresentationRequest.feature
@@ -0,0 +1,38 @@
+Feature: Send Principal Credential Presentation Request
+          I want to change connection status in trusted state from active state. 
+          So I am able to issue credential to the PCM user.
+
+Scenario: Send principal credential presentation request 
+    Given I pass valid connection id.
+    Then  the proof presentation request is sent to the holder with provided attributes.
+
+Scenario: Send principal credential presentation request
+    Given invalid connection id is passed.
+    Then  should return the 500 execption.
+
+Scenario: Send principal credential presentation request
+    Given I am not passing a connection id.
+    Then  should return the Required following attributes ( presentation_id ) with status code 400.
+
+Scenario: Send principal credential presentation request
+    Given I have passed a connection id and credential type.
+    When  passed connection id is valid.
+    And   passed credential type is valid.
+    Then  the get principal credentials details from the attestation service.  
+    And   the proof presentation request sent to the holder with provided attributes. 
+
+Scenario: Send principal credential presentation request
+    Given I have passed a connection id and credential type.
+    When  passed connection id is valid.
+    And   passed credential type is invalid.
+    Then  should not received principal credentials details from the attestation service.  
+    And   should return the 500 execption. 
+
+Scenario: Send principal credential presentation request
+    Given I have passed all the required proof presentation details.
+    When  I passed valid proof presentation details.
+    Then  the proof presentation request sent to the holder with provided attributes.
+    And   should return presentation id
+    And   store presentation id, status, their_did into OCM database.
+    And   should return the valid status code 201.
+
diff --git a/features/proof/webhookCallForUpdateStatus.feature b/features/proof/webhookCallForUpdateStatus.feature
new file mode 100644
index 0000000..6bf3881
--- /dev/null
+++ b/features/proof/webhookCallForUpdateStatus.feature
@@ -0,0 +1,22 @@
+Feature: Webhook call for update presentation status.
+
+Scenario: Received validated DTO from NATS call.
+    Given Webhook valid object .
+    When  passed presentation status as presentation received.
+    And   passed valid proof request id.
+    Then  should update presentation proof status in DB.
+
+Scenario: Received validated DTO from NATS call .
+    Given Webhook valid object .
+    When  passed presentation status as Done.
+    And   passed valid proof request id.
+    Then  should update presentation proof status in DB.
+    And   make connection status to trusted.
+
+Scenario: Received validated DTO from NATS call And Auto accept request is true.
+    Given Webhook valid object .
+    When  passed presentation status as presentation received.
+    And   passed valid proof request id.
+    Then  should update presentation proof status in DB.
+    And   accept presentation proof request.
+    And   return valis message "Presentation received request accepted successfully".
\ No newline at end of file
-- 
GitLab