Skip to content

Commit ca71c4b

Browse files
authored
Merge pull request #7397 from LibreSign/backport/7396/stable32
[stable32] test(integration): wire published behat TSA extension
2 parents 37f18fe + 5939183 commit ca71c4b

7 files changed

Lines changed: 73 additions & 13 deletions

File tree

tests/integration/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"php-http/guzzle7-adapter": "^1.0",
88
"php-http/message": "^1.16",
99
"libresign/nextcloud-behat": "^1.4",
10-
"libresign/mailpit-behat-extension": "^0.1.1"
10+
"libresign/mailpit-behat-extension": "^0.1.1",
11+
"libresign/behat-tsa-extension": "^0.1.0"
1112
},
1213
"config": {
1314
"allow-plugins": {

tests/integration/composer.lock

Lines changed: 54 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/integration/config/behat.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ default:
2020
jarnaiz\JUnitFormatter\JUnitFormatterExtension:
2121
filename: report.xml
2222
outputDir: '%paths.base%/../output/'
23+
LibreSign\Behat\TsaExtension\ServiceContainer\TsaExtension: ~

tests/integration/features/admin/tsa.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Feature: TSA Administration - Core Configuration
44
Given as user "admin"
55

66
When sending "post" to ocs "/apps/libresign/api/v1/admin/tsa"
7-
| tsa_url | https://freetsa.org/tsr |
8-
| tsa_policy | 1.2.3.4.1 |
7+
| tsa_url | <TSA_URL> |
8+
| tsa_policy_oid | 1.2.3.4.1 |
99
| tsa_auth_type | none |
1010
Then the response should have a status code 200
1111
And the response should be a JSON array with the following mandatory values
@@ -16,7 +16,7 @@ Feature: TSA Administration - Core Configuration
1616
Then the response should have a status code 200
1717
And the response should be a JSON array with the following mandatory values
1818
| key | value |
19-
| (jq).ocs.data.data | https://freetsa.org/tsr |
19+
| (jq).ocs.data.data | <TSA_URL> |
2020

2121
When sending "delete" to ocs "/apps/libresign/api/v1/admin/tsa"
2222
Then the response should have a status code 200

tests/integration/features/bootstrap/FeatureContext.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ protected function beforeRequest(string $fullUrl, array $options): array {
4949
protected function parseText(string $text): string {
5050
$fields = $this->fields;
5151
$fields['BASE_URL'] = $this->baseUrl . '/index.php';
52+
$fields['TSA_URL'] = getenv('LIBRESIGN_TSA_URL') ?: 'https://freetsa.org/tsr';
5253
foreach ($fields as $key => $value) {
5354
$patterns[] = '/<' . $key . '>/';
5455
$replacements[] = $value;

tests/integration/features/sign/signed.feature

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ Feature: signed
99
And run the command "libresign:configure:openssl --cn=Common\ Name --c=BR --o=Organization --st=State\ of\ Company --l=City\ Name --ou=Organization\ Unit" with result code 0
1010
And run the command "config:app:set libresign add_footer --value=true --type=boolean" with result code 0
1111
And run the command "config:app:set libresign write_qrcode_on_footer --value=true --type=boolean" with result code 0
12-
And run the command "config:app:set libresign tsa_url --value=https://freetsa.org/tsr --type=string" with result code 0
12+
And sending "post" to ocs "/apps/libresign/api/v1/admin/tsa"
13+
| tsa_url | <TSA_URL> |
14+
| tsa_policy_oid | 1.2.3.4.1 |
15+
| tsa_auth_type | none |
16+
And the response should have a status code 200
1317
And sending "post" to ocs "/apps/provisioning_api/api/v1/config/apps/libresign/identify_methods"
1418
| value | (string)[{"name":"account","enabled":true,"mandatory":true,"signatureMethods":{"password":{"name":"password","enabled":true}},"signatureMethodEnabled":"password"}] |
1519
And the response should have a status code 200

tests/integration/features/sign/tsa.feature

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ Feature: TSA Integration - End-to-End Workflow
1010

1111
Scenario: TSA workflow - Successfully signs document with timestamp
1212
Given run the command "config:app:set libresign signing_mode --value=sync --type=string" with result code 0
13-
And run the command "config:app:set libresign tsa_url --value=https://freetsa.org/tsr --type=string" with result code 0
14-
And run the command "config:app:set libresign tsa_auth_type --value=none --type=string" with result code 0
13+
And sending "post" to ocs "/apps/libresign/api/v1/admin/tsa"
14+
| tsa_url | <TSA_URL> |
15+
| tsa_policy_oid | 1.2.3.4.1 |
16+
| tsa_auth_type | none |
17+
And the response should have a status code 200
1518
And sending "post" to ocs "/apps/provisioning_api/api/v1/config/apps/libresign/identify_methods"
1619
| value | (string)[{"name":"account","enabled":true,"mandatory":true,"signatureMethods":{"clickToSign":{"enabled":true}},"signatureMethodEnabled":"clickToSign"}] |
1720
And the response should have a status code 200
@@ -49,12 +52,8 @@ Feature: TSA Integration - End-to-End Workflow
4952
| key | value |
5053
| (jq).ocs.data.signers[0].timestamp.serialNumber \|test("^[0-9]+$") | true |
5154
And the response should be a JSON array with the following mandatory values
52-
| key | value |
53-
| (jq).ocs.data.signers[0].timestamp.genTime \|test("^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}") | true |
54-
And the response should be a JSON array with the following mandatory values
55-
| key | value |
56-
| (jq).ocs.data.signers[0].timestamp.cnHints.commonName | www.freetsa.org |
57-
| (jq).ocs.data.signers[0].timestamp.cnHints.countryName | DE |
55+
| key | value |
56+
| (jq).ocs.data.signers[0].timestamp.cnHints.commonName \|test("LibreSign Local TSA") | true |
5857

5958
Scenario: TSA error handling - Invalid server
6059
Given run the command "config:app:set libresign tsa_url --value=https://invalid-tsa-server.example.com/tsr --type=string" with result code 0

0 commit comments

Comments
 (0)