Skip to content

Commit 0c65c78

Browse files
test: replace CLI certificate setup with HTTP API calls
Replace 'libresign:configure:openssl --cn test' CLI commands with HTTP POST requests to '/apps/libresign/api/v1/admin/certificate/openssl' in integration tests to prevent race conditions between CLI and HTTP processes during test execution. This ensures all certificate setup happens via HTTP requests, avoiding IAppConfig cache synchronization issues that can occur when mixing CLI commands with HTTP requests in the same test scenario. Signed-off-by: Vitor Mattos <[email protected]> [skip ci]
1 parent fb286b0 commit 0c65c78

1 file changed

Lines changed: 34 additions & 16 deletions

File tree

tests/integration/features/sign/request.feature

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
Feature: request-signature
22
Scenario: Get error when try to request to sign isn't manager
33
Given user "signer1" exists
4+
And as user "admin"
5+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
6+
| rootCert | {"commonName":"test"} |
47
And as user "signer1"
5-
And run the command "libresign:configure:openssl --cn test" with result code 0
68
When sending "post" to ocs "/apps/libresign/api/v1/request-signature"
79
| file | {"base64":""} |
810
| users | [{"identify":{"account":"signer1"}}] |
@@ -15,7 +17,8 @@ Feature: request-signature
1517

1618
Scenario: Get error when try to request to sign without file name
1719
Given as user "admin"
18-
And run the command "libresign:configure:openssl --cn test" with result code 0
20+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
21+
| rootCert | {"commonName":"test"} |
1922
When sending "post" to ocs "/apps/libresign/api/v1/request-signature"
2023
| file | {"invalid":""} |
2124
| users | [{"identify":{"account":"signer1"}}] |
@@ -34,7 +37,8 @@ Feature: request-signature
3437
And my inbox is empty
3538
And reset notifications of user "signer1"
3639
And reset notifications of user "signer2"
37-
And run the command "libresign:configure:openssl --cn test" with result code 0
40+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
41+
| rootCert | {"commonName":"test"} |
3842
And sending "post" to ocs "/apps/libresign/api/v1/request-signature"
3943
| file | {"url":"<BASE_URL>/apps/libresign/develop/pdf"} |
4044
| users | [{"identify":{"account":"signer1"}}] |
@@ -67,7 +71,8 @@ Feature: request-signature
6771
And my inbox is empty
6872
And reset notifications of user "signer1"
6973
And reset notifications of user "signer2"
70-
And run the command "libresign:configure:openssl --cn test" with result code 0
74+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
75+
| rootCert | {"commonName":"test"} |
7176
And sending "post" to ocs "/apps/libresign/api/v1/request-signature"
7277
| file | {"url":"<BASE_URL>/apps/libresign/develop/pdf"} |
7378
| users | [{"identify":{"account":"signer1"}}] |
@@ -94,7 +99,8 @@ Feature: request-signature
9499
Scenario: Request to sign with error when the user is not authenticated
95100
Given as user "admin"
96101
And user "signer1" exists
97-
And run the command "libresign:configure:openssl --cn test" with result code 0
102+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
103+
| rootCert | {"commonName":"test"} |
98104
And reset notifications of user "signer1"
99105
And my inbox is empty
100106
And sending "post" to ocs "/apps/libresign/api/v1/request-signature"
@@ -115,7 +121,8 @@ Feature: request-signature
115121
Scenario: Request to sign with error when the authenticated user have an email different of signer
116122
Given as user "admin"
117123
And user "signer1" exists
118-
And run the command "libresign:configure:openssl --cn test" with result code 0
124+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
125+
| rootCert | {"commonName":"test"} |
119126
And reset notifications of user "signer1"
120127
And set the email of user "signer1" to "[email protected]"
121128
And my inbox is empty
@@ -140,7 +147,8 @@ Feature: request-signature
140147
Scenario: Request to sign with error when the link was expired
141148
Given as user "admin"
142149
And my inbox is empty
143-
And run the command "libresign:configure:openssl --cn test" with result code 0
150+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
151+
| rootCert | {"commonName":"test"} |
144152
And run the command "config:app:set libresign maximum_validity --value=1 --type=integer" with result code 0
145153
When sending "post" to ocs "/apps/libresign/api/v1/request-signature"
146154
| file | {"url":"<BASE_URL>/apps/libresign/develop/pdf"} |
@@ -162,7 +170,8 @@ Feature: request-signature
162170
Scenario: Request to sign with success when is necessary to renew the link
163171
Given as user "admin"
164172
And my inbox is empty
165-
And run the command "libresign:configure:openssl --cn test" with result code 0
173+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
174+
| rootCert | {"commonName":"test"} |
166175
And sending "post" to ocs "/apps/provisioning_api/api/v1/config/apps/libresign/identify_methods"
167176
| value | (string)[{"name":"email","enabled":true,"mandatory":true,"can_create_account":false}] |
168177
And sending "post" to ocs "/apps/libresign/api/v1/request-signature"
@@ -228,7 +237,8 @@ Feature: request-signature
228237
Scenario: Request to sign with success using account as identifier
229238
Given as user "admin"
230239
And user "signer1" exists
231-
And run the command "libresign:configure:openssl --cn test" with result code 0
240+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
241+
| rootCert | {"commonName":"test"} |
232242
And set the email of user "signer1" to "[email protected]"
233243
And reset notifications of user "signer1"
234244
And my inbox is empty
@@ -266,7 +276,8 @@ Feature: request-signature
266276

267277
Scenario: Request to sign with error using account as identifier with invalid email
268278
Given as user "admin"
269-
And run the command "libresign:configure:openssl --cn test" with result code 0
279+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
280+
| rootCert | {"commonName":"test"} |
270281
When sending "post" to ocs "/apps/libresign/api/v1/request-signature"
271282
| file | {"url":"<BASE_URL>/apps/libresign/develop/pdf"} |
272283
| users | [{"identify":{"account":"invaliddomain.test"}}] |
@@ -278,7 +289,8 @@ Feature: request-signature
278289

279290
Scenario: Request to sign with error using email as account identifier
280291
Given as user "admin"
281-
And run the command "libresign:configure:openssl --cn test" with result code 0
292+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
293+
| rootCert | {"commonName":"test"} |
282294
When sending "post" to ocs "/apps/libresign/api/v1/request-signature"
283295
| file | {"url":"<BASE_URL>/apps/libresign/develop/pdf"} |
284296
| users | [{"identify":{"account":"signer3@domain.test"}}] |
@@ -290,7 +302,9 @@ Feature: request-signature
290302

291303
Scenario: Request to sign with success using email as identifier and URL as file
292304
Given as user "admin"
293-
And run the command "libresign:configure:openssl --cn test" with result code 0
305+
And as user "admin"
306+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
307+
| rootCert | {"commonName":"test"} |
294308
And my inbox is empty
295309
When sending "post" to ocs "/apps/libresign/api/v1/request-signature"
296310
| file | {"url":"<BASE_URL>/apps/libresign/develop/pdf"} |
@@ -303,7 +317,8 @@ Feature: request-signature
303317
Scenario: Request to sign with success using account as identifier and URL as file
304318
Given as user "admin"
305319
And user "signer1" exists
306-
And run the command "libresign:configure:openssl --cn test" with result code 0
320+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
321+
| rootCert | {"commonName":"test"} |
307322
And set the email of user "signer1" to ""
308323
And reset notifications of user "signer1"
309324
And my inbox is empty
@@ -321,7 +336,8 @@ Feature: request-signature
321336

322337
Scenario: Request to sign with success using email as identifier
323338
Given as user "admin"
324-
And run the command "libresign:configure:openssl --cn test" with result code 0
339+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
340+
| rootCert | {"commonName":"test"} |
325341
And set the email of user "signer1" to "[email protected]"
326342
And my inbox is empty
327343
When sending "post" to ocs "/apps/libresign/api/v1/request-signature"
@@ -334,7 +350,8 @@ Feature: request-signature
334350

335351
Scenario: Request to sign using email as identifier and when is necessary to use visible elements
336352
Given as user "admin"
337-
And run the command "libresign:configure:openssl --cn test" with result code 0
353+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
354+
| rootCert | {"commonName":"test"} |
338355
And sending "post" to ocs "/apps/provisioning_api/api/v1/config/apps/libresign/identify_methods"
339356
| value | (string)[{"name":"email","enabled":true,"mandatory":true,"can_create_account":false}] |
340357
And I send a file to be signed
@@ -363,7 +380,8 @@ Feature: request-signature
363380
Scenario: Request to sign with success using multiple users
364381
Given as user "admin"
365382
And user "signer1" exists
366-
And run the command "libresign:configure:openssl --cn test" with result code 0
383+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
384+
| rootCert | {"commonName":"test"} |
367385
And set the email of user "signer1" to ""
368386
And my inbox is empty
369387
When sending "post" to ocs "/apps/libresign/api/v1/request-signature"

0 commit comments

Comments
 (0)