Skip to content

Commit 4a4c613

Browse files
committed
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]>
1 parent 3e22061 commit 4a4c613

1 file changed

Lines changed: 35 additions & 16 deletions

File tree

tests/integration/features/sign/request.feature

Lines changed: 35 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,9 @@ 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 as user "admin"
21+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
22+
| rootCert | {"commonName":"test"} |
1923
When sending "post" to ocs "/apps/libresign/api/v1/request-signature"
2024
| file | {"invalid":""} |
2125
| users | [{"identify":{"account":"signer1"}}] |
@@ -34,7 +38,8 @@ Feature: request-signature
3438
And my inbox is empty
3539
And reset notifications of user "signer1"
3640
And reset notifications of user "signer2"
37-
And run the command "libresign:configure:openssl --cn test" with result code 0
41+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
42+
| rootCert | {"commonName":"test"} |
3843
And sending "post" to ocs "/apps/libresign/api/v1/request-signature"
3944
| file | {"url":"<BASE_URL>/apps/libresign/develop/pdf"} |
4045
| users | [{"identify":{"account":"signer1"}}] |
@@ -67,7 +72,8 @@ Feature: request-signature
6772
And my inbox is empty
6873
And reset notifications of user "signer1"
6974
And reset notifications of user "signer2"
70-
And run the command "libresign:configure:openssl --cn test" with result code 0
75+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
76+
| rootCert | {"commonName":"test"} |
7177
And sending "post" to ocs "/apps/libresign/api/v1/request-signature"
7278
| file | {"url":"<BASE_URL>/apps/libresign/develop/pdf"} |
7379
| users | [{"identify":{"account":"signer1"}}] |
@@ -94,7 +100,8 @@ Feature: request-signature
94100
Scenario: Request to sign with error when the user is not authenticated
95101
Given as user "admin"
96102
And user "signer1" exists
97-
And run the command "libresign:configure:openssl --cn test" with result code 0
103+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
104+
| rootCert | {"commonName":"test"} |
98105
And reset notifications of user "signer1"
99106
And my inbox is empty
100107
And sending "post" to ocs "/apps/libresign/api/v1/request-signature"
@@ -115,7 +122,8 @@ Feature: request-signature
115122
Scenario: Request to sign with error when the authenticated user have an email different of signer
116123
Given as user "admin"
117124
And user "signer1" exists
118-
And run the command "libresign:configure:openssl --cn test" with result code 0
125+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
126+
| rootCert | {"commonName":"test"} |
119127
And reset notifications of user "signer1"
120128
And set the email of user "signer1" to "[email protected]"
121129
And my inbox is empty
@@ -140,7 +148,8 @@ Feature: request-signature
140148
Scenario: Request to sign with error when the link was expired
141149
Given as user "admin"
142150
And my inbox is empty
143-
And run the command "libresign:configure:openssl --cn test" with result code 0
151+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
152+
| rootCert | {"commonName":"test"} |
144153
And run the command "config:app:set libresign maximum_validity --value=1 --type=integer" with result code 0
145154
When sending "post" to ocs "/apps/libresign/api/v1/request-signature"
146155
| file | {"url":"<BASE_URL>/apps/libresign/develop/pdf"} |
@@ -162,7 +171,8 @@ Feature: request-signature
162171
Scenario: Request to sign with success when is necessary to renew the link
163172
Given as user "admin"
164173
And my inbox is empty
165-
And run the command "libresign:configure:openssl --cn test" with result code 0
174+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
175+
| rootCert | {"commonName":"test"} |
166176
And sending "post" to ocs "/apps/provisioning_api/api/v1/config/apps/libresign/identify_methods"
167177
| value | (string)[{"name":"email","enabled":true,"mandatory":true,"can_create_account":false}] |
168178
And sending "post" to ocs "/apps/libresign/api/v1/request-signature"
@@ -228,7 +238,8 @@ Feature: request-signature
228238
Scenario: Request to sign with success using account as identifier
229239
Given as user "admin"
230240
And user "signer1" exists
231-
And run the command "libresign:configure:openssl --cn test" with result code 0
241+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
242+
| rootCert | {"commonName":"test"} |
232243
And set the email of user "signer1" to "[email protected]"
233244
And reset notifications of user "signer1"
234245
And my inbox is empty
@@ -266,7 +277,8 @@ Feature: request-signature
266277

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

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

291304
Scenario: Request to sign with success using email as identifier and URL as file
292305
Given as user "admin"
293-
And run the command "libresign:configure:openssl --cn test" with result code 0
306+
And as user "admin"
307+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
308+
| rootCert | {"commonName":"test"} |
294309
And my inbox is empty
295310
When sending "post" to ocs "/apps/libresign/api/v1/request-signature"
296311
| file | {"url":"<BASE_URL>/apps/libresign/develop/pdf"} |
@@ -303,7 +318,8 @@ Feature: request-signature
303318
Scenario: Request to sign with success using account as identifier and URL as file
304319
Given as user "admin"
305320
And user "signer1" exists
306-
And run the command "libresign:configure:openssl --cn test" with result code 0
321+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
322+
| rootCert | {"commonName":"test"} |
307323
And set the email of user "signer1" to ""
308324
And reset notifications of user "signer1"
309325
And my inbox is empty
@@ -321,7 +337,8 @@ Feature: request-signature
321337

322338
Scenario: Request to sign with success using email as identifier
323339
Given as user "admin"
324-
And run the command "libresign:configure:openssl --cn test" with result code 0
340+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
341+
| rootCert | {"commonName":"test"} |
325342
And set the email of user "signer1" to "[email protected]"
326343
And my inbox is empty
327344
When sending "post" to ocs "/apps/libresign/api/v1/request-signature"
@@ -334,7 +351,8 @@ Feature: request-signature
334351

335352
Scenario: Request to sign using email as identifier and when is necessary to use visible elements
336353
Given as user "admin"
337-
And run the command "libresign:configure:openssl --cn test" with result code 0
354+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
355+
| rootCert | {"commonName":"test"} |
338356
And sending "post" to ocs "/apps/provisioning_api/api/v1/config/apps/libresign/identify_methods"
339357
| value | (string)[{"name":"email","enabled":true,"mandatory":true,"can_create_account":false}] |
340358
And I send a file to be signed
@@ -363,7 +381,8 @@ Feature: request-signature
363381
Scenario: Request to sign with success using multiple users
364382
Given as user "admin"
365383
And user "signer1" exists
366-
And run the command "libresign:configure:openssl --cn test" with result code 0
384+
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
385+
| rootCert | {"commonName":"test"} |
367386
And set the email of user "signer1" to ""
368387
And my inbox is empty
369388
When sending "post" to ocs "/apps/libresign/api/v1/request-signature"

0 commit comments

Comments
 (0)