Skip to content

Commit 867f89f

Browse files
committed
test: add Behat integration tests for sequential signing
- Test parallel signing: all signers can sign immediately - Test sequential signing: order enforced, status transitions validated - Verify status 422 when signer attempts to sign out of order - Verify status changes from DRAFT to ABLE_TO_SIGN after previous signer completes Signed-off-by: Vitor Mattos <[email protected]>
1 parent db30f77 commit 867f89f

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
Feature: sequential-signing
2+
Background:
3+
Given as user "admin"
4+
And run the command "libresign:install --use-local-cert --java" with result code 0
5+
And run the command "libresign:install --use-local-cert --jsignpdf" with result code 0
6+
And run the command "libresign:install --use-local-cert --pdftk" with result code 0
7+
And run the command "libresign:configure:openssl --cn=Common\ Name" with result code 0
8+
And sending "post" to ocs "/apps/provisioning_api/api/v1/config/apps/libresign/identify_methods"
9+
| value | (string)[{"name":"account","enabled":true,"mandatory":true,"signatureMethods":{"clickToSign":{"enabled":true}}}] |
10+
And the response should have a status code 200
11+
12+
Scenario: Parallel signing - all signers can sign immediately
13+
Given user "signer1" exists
14+
And user "signer2" exists
15+
When sending "post" to ocs "/apps/libresign/api/v1/request-signature"
16+
| file | {"url":"<BASE_URL>/apps/libresign/develop/pdf"} |
17+
| users | [{"identify":{"account":"signer1"}},{"identify":{"account":"signer2"}}] |
18+
| name | Parallel Document |
19+
Then the response should have a status code 200
20+
And as user "signer1"
21+
And sending "get" to ocs "/apps/libresign/api/v1/file/list"
22+
And the response should have a status code 200
23+
And fetch field "(SIGN_UUID_1)ocs.data.data.0.signers.0.sign_uuid" from previous JSON response
24+
When sending "post" to ocs "/apps/libresign/api/v1/sign/uuid/<SIGN_UUID_1>"
25+
| method | clickToSign |
26+
Then the response should have a status code 200
27+
And as user "signer2"
28+
And sending "get" to ocs "/apps/libresign/api/v1/file/list"
29+
And the response should have a status code 200
30+
And fetch field "(SIGN_UUID_2)ocs.data.data.0.signers.1.sign_uuid" from previous JSON response
31+
When sending "post" to ocs "/apps/libresign/api/v1/sign/uuid/<SIGN_UUID_2>"
32+
| method | clickToSign |
33+
Then the response should have a status code 200
34+
35+
Scenario: Sequential signing - only first signer can sign initially
36+
Given user "signer1" exists
37+
And user "signer2" exists
38+
And sending "post" to ocs "/apps/libresign/api/v1/admin/signature-flow"
39+
| flow | ordered_numeric |
40+
And the response should have a status code 200
41+
When sending "post" to ocs "/apps/libresign/api/v1/request-signature"
42+
| file | {"url":"<BASE_URL>/apps/libresign/develop/pdf"} |
43+
| users | [{"identify":{"account":"signer1"},"signingOrder":1},{"identify":{"account":"signer2"},"signingOrder":2}] |
44+
| name | Sequential Document |
45+
Then the response should have a status code 200
46+
And as user "signer2"
47+
And sending "get" to ocs "/apps/libresign/api/v1/file/list"
48+
And the response should have a status code 200
49+
And fetch field "(SIGN_UUID_2)ocs.data.data.0.signers.1.sign_uuid" from previous JSON response
50+
When sending "post" to ocs "/apps/libresign/api/v1/sign/uuid/<SIGN_UUID_2>"
51+
| method | clickToSign |
52+
Then the response should have a status code 422
53+
And as user "signer1"
54+
And sending "get" to ocs "/apps/libresign/api/v1/file/list"
55+
And the response should have a status code 200
56+
And fetch field "(SIGN_UUID_1)ocs.data.data.0.signers.0.sign_uuid" from previous JSON response
57+
When sending "post" to ocs "/apps/libresign/api/v1/sign/uuid/<SIGN_UUID_1>"
58+
| method | clickToSign |
59+
Then the response should have a status code 200
60+
And as user "signer2"
61+
When sending "post" to ocs "/apps/libresign/api/v1/sign/uuid/<SIGN_UUID_2>"
62+
| method | clickToSign |
63+
Then the response should have a status code 200

0 commit comments

Comments
 (0)