From 5f6455930ec5a1c5ce9121466df300922a524509 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Fri, 5 Apr 2024 17:29:30 -0300 Subject: [PATCH 1/6] chore: Bump dependencies Signed-off-by: Vitor Mattos --- tests/integration/composer.lock | 52 ++++++++++++++++----------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/tests/integration/composer.lock b/tests/integration/composer.lock index e8cb1bd8ca..be8007ea32 100644 --- a/tests/integration/composer.lock +++ b/tests/integration/composer.lock @@ -1586,16 +1586,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.18", + "version": "9.6.19", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "32c2c2d6580b1d8ab3c10b1e9e4dc263cc69bb04" + "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/32c2c2d6580b1d8ab3c10b1e9e4dc263cc69bb04", - "reference": "32c2c2d6580b1d8ab3c10b1e9e4dc263cc69bb04", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a1a54a473501ef4cdeaae4e06891674114d79db8", + "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8", "shasum": "" }, "require": { @@ -1669,7 +1669,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.18" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.19" }, "funding": [ { @@ -1685,7 +1685,7 @@ "type": "tidelift" } ], - "time": "2024-03-21T12:07:32+00:00" + "time": "2024-04-05T04:35:58+00:00" }, { "name": "psr-discovery/discovery", @@ -3902,23 +3902,23 @@ }, { "name": "symfony/http-client", - "version": "v5.4.37", + "version": "v5.4.38", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "63d93fd99523b9608929a38172da3365a6c0821c" + "reference": "2a292194f6d4cf22d2348248d1c637750f72309d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/63d93fd99523b9608929a38172da3365a6c0821c", - "reference": "63d93fd99523b9608929a38172da3365a6c0821c", + "url": "https://api.github.com/repos/symfony/http-client/zipball/2a292194f6d4cf22d2348248d1c637750f72309d", + "reference": "2a292194f6d4cf22d2348248d1c637750f72309d", "shasum": "" }, "require": { "php": ">=7.2.5", "psr/log": "^1|^2|^3", "symfony/deprecation-contracts": "^2.1|^3", - "symfony/http-client-contracts": "^2.4", + "symfony/http-client-contracts": "^2.5.3", "symfony/polyfill-php73": "^1.11", "symfony/polyfill-php80": "^1.16", "symfony/service-contracts": "^1.0|^2|^3" @@ -3934,7 +3934,7 @@ "amphp/http-client": "^4.2.1", "amphp/http-tunnel": "^1.0", "amphp/socket": "^1.1", - "guzzlehttp/promises": "^1.4", + "guzzlehttp/promises": "^1.4|^2.0", "nyholm/psr7": "^1.0", "php-http/httplug": "^1.0|^2.0", "php-http/message-factory": "^1.0", @@ -3973,7 +3973,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v5.4.37" + "source": "https://github.com/symfony/http-client/tree/v5.4.38" }, "funding": [ { @@ -3989,20 +3989,20 @@ "type": "tidelift" } ], - "time": "2024-02-28T15:18:15+00:00" + "time": "2024-04-01T18:54:44+00:00" }, { "name": "symfony/http-client-contracts", - "version": "v2.5.2", + "version": "v2.5.3", "source": { "type": "git", "url": "https://github.com/symfony/http-client-contracts.git", - "reference": "ba6a9f0e8f3edd190520ee3b9a958596b6ca2e70" + "reference": "e5cc97c2b4a4db0ba26bebc154f1426e3fd1d2f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/ba6a9f0e8f3edd190520ee3b9a958596b6ca2e70", - "reference": "ba6a9f0e8f3edd190520ee3b9a958596b6ca2e70", + "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/e5cc97c2b4a4db0ba26bebc154f1426e3fd1d2f1", + "reference": "e5cc97c2b4a4db0ba26bebc154f1426e3fd1d2f1", "shasum": "" }, "require": { @@ -4051,7 +4051,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/http-client-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/http-client-contracts/tree/v2.5.3" }, "funding": [ { @@ -4067,7 +4067,7 @@ "type": "tidelift" } ], - "time": "2022-04-12T15:48:08+00:00" + "time": "2024-03-26T19:42:53+00:00" }, { "name": "symfony/polyfill-ctype", @@ -5184,16 +5184,16 @@ }, { "name": "libresign/nextcloud-behat", - "version": "v0.14.1", + "version": "v0.14.2", "source": { "type": "git", "url": "https://github.com/LibreSign/nextcloud-behat.git", - "reference": "6ba7c59e59f0b4aaaa5ce67d16affb9479874d0d" + "reference": "114818c0f0f160ebe8345f77cf17252ebee71916" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/LibreSign/nextcloud-behat/zipball/6ba7c59e59f0b4aaaa5ce67d16affb9479874d0d", - "reference": "6ba7c59e59f0b4aaaa5ce67d16affb9479874d0d", + "url": "https://api.github.com/repos/LibreSign/nextcloud-behat/zipball/114818c0f0f160ebe8345f77cf17252ebee71916", + "reference": "114818c0f0f160ebe8345f77cf17252ebee71916", "shasum": "" }, "require": { @@ -5238,9 +5238,9 @@ ], "support": { "issues": "https://github.com/LibreSign/nextcloud-behat/issues", - "source": "https://github.com/LibreSign/nextcloud-behat/tree/v0.14.1" + "source": "https://github.com/LibreSign/nextcloud-behat/tree/v0.14.2" }, - "time": "2024-03-22T16:35:47+00:00" + "time": "2024-04-05T20:28:06+00:00" }, { "name": "symfony/process", From 17e16c0d206e979b09e50c68b4e0bbbe06310f3f Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Fri, 5 Apr 2024 17:30:17 -0300 Subject: [PATCH 2/6] fix: make compatible with old pattern TODO: remove the >signer pattern Signed-off-by: Vitor Mattos --- .../features/bootstrap/FeatureContext.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index f8fc8471e0..06eb4ffe5c 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -125,15 +125,12 @@ protected function beforeRequest(string $fullUrl, array $options): array { } protected function parseText(string $text): string { - $patterns = [ - '//', - '//', - ]; - $replacements = [ - $this->signer['sign_uuid'] ?? null, - $this->baseUrl . '/index.php', - ]; - foreach ($this->fields as $key => $value) { + $fields = $this->fields; + if (!empty($this->signer['sign_uuid'])) { + $fields = $this->signer['sign_uuid']; + } + $fields['BASE_URL'] = $this->baseUrl . '/index.php'; + foreach ($fields as $key => $value) { $patterns[] = '/<' . $key . '>/'; $replacements[] = $value; } From 3a9e9d8d058e20b25241593a1a8b288d30b28782 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Fri, 5 Apr 2024 18:20:57 -0300 Subject: [PATCH 3/6] feat: scenario to sign file New scenario to cover the sign act Signed-off-by: Vitor Mattos --- .../integration/features/sign/request.feature | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/integration/features/sign/request.feature b/tests/integration/features/sign/request.feature index 2454d7f430..2e38bda1ab 100644 --- a/tests/integration/features/sign/request.feature +++ b/tests/integration/features/sign/request.feature @@ -314,6 +314,43 @@ Feature: request-signature | type | signature | Then the response should have a status code 200 + Scenario: Sign file + Given as user "admin" + And user "signer1" exists + And run the command "libresign:install --java" with result code 0 + And run the command "libresign:install --jsignpdf" with result code 0 + And run the command "libresign:install --pdftk" with result code 0 + 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=1" with result code 0 + And run the command "config:app:set libresign write_qrcode_on_footer --value=1" with result code 0 + 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 + And my inbox is empty + When sending "post" to ocs "/apps/libresign/api/v1/request-signature" + | file | {"url":"/apps/libresign/develop/pdf"} | + | users | [{"displayName": "Signer Name","description": "Please, sign this document","identify": {"account": "signer1"}}] | + | name | Document Name | + And the response should have a status code 200 + And as user "signer1" + And sending "get" to ocs "/apps/libresign/api/v1/file/list" + Then the response should be a JSON array with the following mandatory values + | key | value | + | data | (jq).[].name == "Document Name"| + And fetch field "(SIGN_URL)data.0.url" from prevous JSON response + And fetch field "(SIGN_UUID)data.0.signers.0.sign_uuid" from prevous JSON response + And fetch field "(FILE_UUID)data.0.uuid" from prevous JSON response + And sending "post" to ocs "/apps/libresign/api/v1/account/signature" + | signPassword | TheComplexPfxPasswordHere | + And sending "post" to ocs "/apps/libresign/api/v1/sign/uuid/" + | method | password | + | token | TheComplexPfxPasswordHere | + And the response should have a status code 200 + Then the response should be a JSON array with the following mandatory values + | key | value | + | message | File signed | + | (jq).file.uuid | | + Scenario: Request to sign with success using multiple users Given as user "admin" And user "signer1" exists From 571dfabdfbb43ca4868942842576853e5f5db38f Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Sat, 6 Apr 2024 13:18:40 -0300 Subject: [PATCH 4/6] fix: don't override var Signed-off-by: Vitor Mattos --- tests/integration/features/bootstrap/FeatureContext.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index 06eb4ffe5c..b6613e4ea9 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -127,7 +127,7 @@ protected function beforeRequest(string $fullUrl, array $options): array { protected function parseText(string $text): string { $fields = $this->fields; if (!empty($this->signer['sign_uuid'])) { - $fields = $this->signer['sign_uuid']; + $fields[] = $this->signer['sign_uuid']; } $fields['BASE_URL'] = $this->baseUrl . '/index.php'; foreach ($fields as $key => $value) { From 1346a66606c627c00b52023d8b66081b7ab5c950 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Sat, 6 Apr 2024 13:19:01 -0300 Subject: [PATCH 5/6] fix: method name Signed-off-by: Vitor Mattos --- tests/integration/features/bootstrap/FeatureContext.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index b6613e4ea9..bfde040405 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -185,7 +185,7 @@ public function iSendAFileToBeSigned(TableNode $body): void { /** * @When follow the link on opened email */ - public function iDoSomethingWithTheOpenedEmail(): void { + public function followTheLinkOnOpenedEmail(): void { if (!$this->openedEmailStorage->hasOpenedEmail()) { throw new RuntimeException('No email opened, unable to do something!'); } From 293a117c50d4fccd69418cd51533b1e11d125bb2 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Sat, 6 Apr 2024 13:35:21 -0300 Subject: [PATCH 6/6] fix: Add array key Signed-off-by: Vitor Mattos --- tests/integration/features/bootstrap/FeatureContext.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index bfde040405..f0a79259fd 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -127,7 +127,7 @@ protected function beforeRequest(string $fullUrl, array $options): array { protected function parseText(string $text): string { $fields = $this->fields; if (!empty($this->signer['sign_uuid'])) { - $fields[] = $this->signer['sign_uuid']; + $fields['SIGN_UUID'] = $this->signer['sign_uuid']; } $fields['BASE_URL'] = $this->baseUrl . '/index.php'; foreach ($fields as $key => $value) {