Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tests/integration/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"php-http/guzzle7-adapter": "^1.0",
"php-http/message": "^1.16",
"libresign/nextcloud-behat": "^1.4",
"libresign/mailpit-behat-extension": "^0.1.1"
"libresign/mailpit-behat-extension": "^0.1.1",
"libresign/behat-tsa-extension": "^0.1.0"
},
"config": {
"allow-plugins": {
Expand Down
54 changes: 54 additions & 0 deletions tests/integration/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tests/integration/config/behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ default:
jarnaiz\JUnitFormatter\JUnitFormatterExtension:
filename: report.xml
outputDir: '%paths.base%/../output/'
LibreSign\Behat\TsaExtension\ServiceContainer\TsaExtension: ~
6 changes: 3 additions & 3 deletions tests/integration/features/admin/tsa.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Feature: TSA Administration - Core Configuration
Given as user "admin"

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

When sending "delete" to ocs "/apps/libresign/api/v1/admin/tsa"
Then the response should have a status code 200
Expand Down
1 change: 1 addition & 0 deletions tests/integration/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ protected function beforeRequest(string $fullUrl, array $options): array {
protected function parseText(string $text): string {
$fields = $this->fields;
$fields['BASE_URL'] = $this->baseUrl . '/index.php';
$fields['TSA_URL'] = getenv('LIBRESIGN_TSA_URL') ?: 'https://freetsa.org/tsr';
foreach ($fields as $key => $value) {
$patterns[] = '/<' . $key . '>/';
$replacements[] = $value;
Expand Down
6 changes: 5 additions & 1 deletion tests/integration/features/sign/signed.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ Feature: signed
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
And run the command "config:app:set libresign add_footer --value=true --type=boolean" with result code 0
And run the command "config:app:set libresign write_qrcode_on_footer --value=true --type=boolean" with result code 0
And run the command "config:app:set libresign tsa_url --value=https://freetsa.org/tsr --type=string" with result code 0
And sending "post" to ocs "/apps/libresign/api/v1/admin/tsa"
| tsa_url | <TSA_URL> |
| tsa_policy_oid | 1.2.3.4.1 |
| tsa_auth_type | none |
And the response should have a status code 200
And sending "post" to ocs "/apps/provisioning_api/api/v1/config/apps/libresign/identify_methods"
| value | (string)[{"name":"account","enabled":true,"mandatory":true,"signatureMethods":{"password":{"name":"password","enabled":true}},"signatureMethodEnabled":"password"}] |
And the response should have a status code 200
Expand Down
15 changes: 7 additions & 8 deletions tests/integration/features/sign/tsa.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ Feature: TSA Integration - End-to-End Workflow

Scenario: TSA workflow - Successfully signs document with timestamp
Given run the command "config:app:set libresign signing_mode --value=sync --type=string" with result code 0
And run the command "config:app:set libresign tsa_url --value=https://freetsa.org/tsr --type=string" with result code 0
And run the command "config:app:set libresign tsa_auth_type --value=none --type=string" with result code 0
And sending "post" to ocs "/apps/libresign/api/v1/admin/tsa"
| tsa_url | <TSA_URL> |
| tsa_policy_oid | 1.2.3.4.1 |
| tsa_auth_type | none |
And the response should have a status code 200
And sending "post" to ocs "/apps/provisioning_api/api/v1/config/apps/libresign/identify_methods"
| value | (string)[{"name":"account","enabled":true,"mandatory":true,"signatureMethods":{"clickToSign":{"enabled":true}},"signatureMethodEnabled":"clickToSign"}] |
And the response should have a status code 200
Expand Down Expand Up @@ -49,12 +52,8 @@ Feature: TSA Integration - End-to-End Workflow
| key | value |
| (jq).ocs.data.signers[0].timestamp.serialNumber \|test("^[0-9]+$") | true |
And the response should be a JSON array with the following mandatory values
| key | value |
| (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 |
And the response should be a JSON array with the following mandatory values
| key | value |
| (jq).ocs.data.signers[0].timestamp.cnHints.commonName | www.freetsa.org |
| (jq).ocs.data.signers[0].timestamp.cnHints.countryName | DE |
| key | value |
| (jq).ocs.data.signers[0].timestamp.cnHints.commonName \|test("LibreSign Local TSA") | true |

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