Skip to content

Commit 650d26e

Browse files
committed
test: add integration tests for signature request cancellation
Adds Behat tests covering three scenarios: 1. Deleting pending request sends cancellation notification 2. Deleting draft request does not send notification 3. Deletion removes signer from file list Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent dacf038 commit 650d26e

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
Feature: sign-request-cancel
2+
Scenario: Delete pending signature request sends cancellation notification
3+
Given as user "admin"
4+
And user "signer1" exists
5+
And reset notifications of user "signer1"
6+
And run the command "libresign:configure:openssl --cn test" with result code 0
7+
And sending "post" to ocs "/apps/libresign/api/v1/request-signature"
8+
| file | {"url":"<BASE_URL>/apps/libresign/develop/pdf"} |
9+
| users | [{"identify":{"account":"signer1"}}] |
10+
| name | document |
11+
And the response should have a status code 200
12+
And sending "get" to ocs "/apps/libresign/api/v1/file/list"
13+
And fetch field "(NODE_ID)ocs.data.data.0.nodeId" from previous JSON response
14+
And fetch field "(SIGN_REQUEST_ID)ocs.data.data.0.signers.0.signRequestId" from previous JSON response
15+
When sending "delete" to ocs "/apps/libresign/api/v1/sign/file_id/<NODE_ID>/<SIGN_REQUEST_ID>"
16+
Then the response should have a status code 200
17+
When as user "signer1"
18+
And sending "get" to ocs "/apps/notifications/api/v2/notifications"
19+
Then the response should be a JSON array with the following mandatory values
20+
| key | value |
21+
| (jq).ocs.data[0].subject | admin canceled the signature request for document |
22+
23+
Scenario: Delete draft request does not send cancellation notification
24+
Given as user "admin"
25+
And user "signer1" exists
26+
And reset notifications of user "signer1"
27+
And run the command "libresign:configure:openssl --cn test" with result code 0
28+
And sending "post" to ocs "/apps/libresign/api/v1/request-signature"
29+
| file | {"url":"<BASE_URL>/apps/libresign/develop/pdf"} |
30+
| users | [{"identify":{"account":"signer1"},"notify":false}] |
31+
| name | document |
32+
| status | 0 |
33+
And the response should have a status code 200
34+
When sending "get" to ocs "/apps/libresign/api/v1/file/list"
35+
And fetch field "(NODE_ID)ocs.data.data.0.nodeId" from previous JSON response
36+
And fetch field "(SIGN_REQUEST_ID)ocs.data.data.0.signers.0.signRequestId" from previous JSON response
37+
And sending "delete" to ocs "/apps/libresign/api/v1/sign/file_id/<NODE_ID>/<SIGN_REQUEST_ID>"
38+
Then the response should have a status code 200
39+
When as user "signer1"
40+
And sending "get" to ocs "/apps/notifications/api/v2/notifications"
41+
Then the response should be a JSON array with the following mandatory values
42+
| key | value |
43+
| (jq).ocs.data | [] |
44+
45+
Scenario: Delete signer removes them from file list
46+
Given as user "admin"
47+
And user "signer1" exists
48+
And run the command "libresign:configure:openssl --cn test" with result code 0
49+
And sending "post" to ocs "/apps/libresign/api/v1/request-signature"
50+
| file | {"url":"<BASE_URL>/apps/libresign/develop/pdf"} |
51+
| users | [{"identify":{"account":"signer1"}}] |
52+
| name | document |
53+
When sending "get" to ocs "/apps/libresign/api/v1/file/list"
54+
And fetch field "(NODE_ID)ocs.data.data.0.nodeId" from previous JSON response
55+
And fetch field "(SIGN_REQUEST_ID)ocs.data.data.0.signers.0.signRequestId" from previous JSON response
56+
And sending "delete" to ocs "/apps/libresign/api/v1/sign/file_id/<NODE_ID>/<SIGN_REQUEST_ID>"
57+
And sending "get" to ocs "/apps/libresign/api/v1/file/list"
58+
Then the response should be a JSON array with the following mandatory values
59+
| key | value |
60+
| (jq).ocs.data.data[0].signers | [] |

0 commit comments

Comments
 (0)