diff options
Diffstat (limited to 'build/integration')
9 files changed, 905 insertions, 11 deletions
diff --git a/build/integration/config/behat.yml b/build/integration/config/behat.yml index 27d7daa4818..79ffe58f6b6 100644 --- a/build/integration/config/behat.yml +++ b/build/integration/config/behat.yml @@ -65,6 +65,7 @@ default: - admin - admin regular_user_password: 123456 + - TalkContext setup: paths: - "%paths.base%/../setup_features" diff --git a/build/integration/features/bootstrap/BasicStructure.php b/build/integration/features/bootstrap/BasicStructure.php index 03cdd58833e..20d5727a86c 100644 --- a/build/integration/features/bootstrap/BasicStructure.php +++ b/build/integration/features/bootstrap/BasicStructure.php @@ -46,6 +46,7 @@ trait BasicStructure { use Auth; use Download; + use Mail; use Trashbin; /** @var string */ diff --git a/build/integration/features/bootstrap/FakeSMTPHelper.php b/build/integration/features/bootstrap/FakeSMTPHelper.php new file mode 100644 index 00000000000..9a64b6d31de --- /dev/null +++ b/build/integration/features/bootstrap/FakeSMTPHelper.php @@ -0,0 +1,159 @@ +<?php + +// Code below modified from https://github.com/axllent/fake-smtp/blob/f0856f8a0df6f4ca5a573cf31428c09ebc5b9ea3/fakeSMTP.php, +// which is under the MIT license (https://github.com/axllent/fake-smtp/blob/f0856f8a0df6f4ca5a573cf31428c09ebc5b9ea3/LICENSE) + +/** + * fakeSMTP - A PHP / inetd fake smtp server. + * Allows client<->server interaction + * The comunication is based upon the SMPT standards defined in http://www.lesnikowski.com/mail/Rfc/rfc2821.txt + */ + +class fakeSMTP { + public $logFile = false; + public $serverHello = 'fakeSMTP ESMTP PHP Mail Server Ready'; + + public function __construct($fd) { + $this->mail = []; + $this->mail['ipaddress'] = false; + $this->mail['emailSender'] = ''; + $this->mail['emailRecipients'] = []; + $this->mail['emailSubject'] = false; + $this->mail['rawEmail'] = false; + $this->mail['emailHeaders'] = false; + $this->mail['emailBody'] = false; + + $this->fd = $fd; + } + + public function receive() { + $hasValidFrom = false; + $hasValidTo = false; + $receivingData = false; + $header = true; + $this->reply('220 '.$this->serverHello); + $this->mail['ipaddress'] = $this->detectIP(); + while ($data = fgets($this->fd)) { + $data = preg_replace('@\r\n@', "\n", $data); + + if (!$receivingData) { + $this->log($data); + } + + if (!$receivingData && preg_match('/^MAIL FROM:\s?<(.*)>/i', $data, $match)) { + if (preg_match('/(.*)@\[.*\]/i', $match[1]) || $match[1] != '' || $this->validateEmail($match[1])) { + $this->mail['emailSender'] = $match[1]; + $this->reply('250 2.1.0 Ok'); + $hasValidFrom = true; + } else { + $this->reply('551 5.1.7 Bad sender address syntax'); + } + } elseif (!$receivingData && preg_match('/^RCPT TO:\s?<(.*)>/i', $data, $match)) { + if (!$hasValidFrom) { + $this->reply('503 5.5.1 Error: need MAIL command'); + } else { + if (preg_match('/postmaster@\[.*\]/i', $match[1]) || $this->validateEmail($match[1])) { + array_push($this->mail['emailRecipients'], $match[1]); + $this->reply('250 2.1.5 Ok'); + $hasValidTo = true; + } else { + $this->reply('501 5.1.3 Bad recipient address syntax '.$match[1]); + } + } + } elseif (!$receivingData && preg_match('/^RSET$/i', trim($data))) { + $this->reply('250 2.0.0 Ok'); + $hasValidFrom = false; + $hasValidTo = false; + } elseif (!$receivingData && preg_match('/^NOOP$/i', trim($data))) { + $this->reply('250 2.0.0 Ok'); + } elseif (!$receivingData && preg_match('/^VRFY (.*)/i', trim($data), $match)) { + $this->reply('250 2.0.0 '.$match[1]); + } elseif (!$receivingData && preg_match('/^DATA/i', trim($data))) { + if (!$hasValidTo) { + $this->reply('503 5.5.1 Error: need RCPT command'); + } else { + $this->reply('354 Ok Send data ending with <CRLF>.<CRLF>'); + $receivingData = true; + } + } elseif (!$receivingData && preg_match('/^(HELO|EHLO)/i', $data)) { + $this->reply('250 HELO '.$this->mail['ipaddress']); + } elseif (!$receivingData && preg_match('/^QUIT/i', trim($data))) { + break; + } elseif (!$receivingData) { + //~ $this->reply('250 Ok'); + $this->reply('502 5.5.2 Error: command not recognized'); + } elseif ($receivingData && $data == ".\n") { + /* Email Received, now let's look at it */ + $receivingData = false; + $this->reply('250 2.0.0 Ok: queued as '.$this->generateRandom(10)); + $splitmail = explode("\n\n", $this->mail['rawEmail'], 2); + if (count($splitmail) == 2) { + $this->mail['emailHeaders'] = $splitmail[0]; + $this->mail['emailBody'] = $splitmail[1]; + $headers = preg_replace("/ \s+/", ' ', preg_replace("/\n\s/", ' ', $this->mail['emailHeaders'])); + $headerlines = explode("\n", $headers); + for ($i=0; $i<count($headerlines); $i++) { + if (preg_match('/^Subject: (.*)/i', $headerlines[$i], $matches)) { + $this->mail['emailSubject'] = trim($matches[1]); + } + } + } else { + $this->mail['emailBody'] = $splitmail[0]; + } + set_time_limit(5); // Just run the exit to prevent open threads / abuse + } elseif ($receivingData) { + $this->mail['rawEmail'] .= $data; + } + } + /* Say good bye */ + $this->reply('221 2.0.0 Bye '.$this->mail['ipaddress']); + + fclose($this->fd); + } + + public function log($s) { + if ($this->logFile) { + file_put_contents($this->logFile, trim($s)."\n", FILE_APPEND); + } + } + + private function reply($s) { + $this->log("REPLY:$s"); + fwrite($this->fd, $s . "\r\n"); + } + + private function detectIP() { + $raw = explode(':', stream_socket_get_name($this->fd, true)); + return $raw[0]; + } + + private function validateEmail($email) { + return preg_match('/^[_a-z0-9-+]+(\.[_a-z0-9-+]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/', strtolower($email)); + } + + private function generateRandom($length=8) { + $password = ''; + $possible = '2346789BCDFGHJKLMNPQRTVWXYZ'; + $maxlength = strlen($possible); + $i = 0; + for ($i=0; $i < $length; $i++) { + $char = substr($possible, mt_rand(0, $maxlength-1), 1); + if (!strstr($password, $char)) { + $password .= $char; + } + } + return $password; + } +} + +$socket = stream_socket_server('tcp://127.0.0.1:2525', $errno, $errstr); +if (!$socket) { + exit(); +} + +while ($fd = stream_socket_accept($socket)) { + $fakeSMTP = new fakeSMTP($fd); + $fakeSMTP->receive(); +} + +fclose($socket); diff --git a/build/integration/features/bootstrap/Mail.php b/build/integration/features/bootstrap/Mail.php new file mode 100644 index 00000000000..d347636c8aa --- /dev/null +++ b/build/integration/features/bootstrap/Mail.php @@ -0,0 +1,57 @@ +<?php +/** + * @copyright Copyright (c) 2020, Daniel Calviño Sánchez (danxuliu@gmail.com) + * + * @author Daniel Calviño Sánchez <danxuliu@gmail.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +trait Mail { + + // CommandLine trait is expected to be used in the class that uses this + // trait. + + /** + * @var string + */ + private $fakeSmtpServerPid; + + /** + * @AfterScenario + */ + public function killDummyMailServer() { + if (!$this->fakeSmtpServerPid) { + return; + } + + exec("kill " . $this->fakeSmtpServerPid); + + $this->invokingTheCommand('config:system:delete mail_smtpport'); + } + + /** + * @Given /^dummy mail server is listening$/ + */ + public function dummyMailServerIsListening() { + // Default smtpport (25) is restricted for regular users, so the + // FakeSMTP uses 2525 instead. + $this->invokingTheCommand('config:system:set mail_smtpport --value=2525 --type integer'); + + $this->fakeSmtpServerPid = exec("php features/bootstrap/FakeSMTPHelper.php >/dev/null 2>&1 & echo $!"); + } +} diff --git a/build/integration/features/bootstrap/Sharing.php b/build/integration/features/bootstrap/Sharing.php index 66b15436438..fee8f7d2692 100644 --- a/build/integration/features/bootstrap/Sharing.php +++ b/build/integration/features/bootstrap/Sharing.php @@ -150,11 +150,9 @@ trait Sharing { } /** - * @Then /^Public shared file "([^"]*)" can be downloaded$/ + * @Then /^last link share can be downloaded$/ */ - public function checkPublicSharedFile($filename) { - $client = new Client(); - $options = []; + public function lastLinkShareCanBeDownloaded() { if (count($this->lastShareData->data->element) > 0){ $url = $this->lastShareData->data[0]->url; } @@ -166,10 +164,23 @@ trait Sharing { } /** - * @Then /^Public shared file "([^"]*)" with password "([^"]*)" can be downloaded$/ + * @Then /^last share can be downloaded$/ */ - public function checkPublicSharedFileWithPassword($filename, $password) { - $options = []; + public function lastShareCanBeDownloaded() { + if (count($this->lastShareData->data->element) > 0) { + $token = $this->lastShareData->data[0]->token; + } else { + $token = $this->lastShareData->data->token; + } + + $fullUrl = substr($this->baseUrl, 0, -4) . "index.php/s/" . $token . "/download"; + $this->checkDownload($fullUrl, null, 'text/plain'); + } + + /** + * @Then /^last share with password "([^"]*)" can be downloaded$/ + */ + public function lastShareWithPasswordCanBeDownloaded($password) { if (count($this->lastShareData->data->element) > 0){ $token = $this->lastShareData->data[0]->token; } diff --git a/build/integration/features/bootstrap/SharingContext.php b/build/integration/features/bootstrap/SharingContext.php index cace64e4f8a..1c2ce694e0f 100644 --- a/build/integration/features/bootstrap/SharingContext.php +++ b/build/integration/features/bootstrap/SharingContext.php @@ -34,6 +34,9 @@ require __DIR__ . '/../../vendor/autoload.php'; class SharingContext implements Context, SnippetAcceptingContext { use Sharing; use AppConfiguration; + use CommandLine; - protected function resetAppConfigs() {} + protected function resetAppConfigs() { + $this->modifyServerConfig('sharebymail', 'enforcePasswordProtection', 'no'); + } } diff --git a/build/integration/features/bootstrap/TalkContext.php b/build/integration/features/bootstrap/TalkContext.php new file mode 100644 index 00000000000..bc61c87ebab --- /dev/null +++ b/build/integration/features/bootstrap/TalkContext.php @@ -0,0 +1,72 @@ +<?php +/** + * @copyright Copyright (c) 2020, Daniel Calviño Sánchez (danxuliu@gmail.com) + * + * @author Daniel Calviño Sánchez <danxuliu@gmail.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +use Behat\Behat\Context\Context; + +class TalkContext implements Context { + + /** + * @BeforeFeature @Talk + * @BeforeScenario @Talk + */ + public static function skipTestsIfTalkIsNotInstalled() { + if (!TalkContext::isTalkInstalled()) { + throw new Exception('Talk needs to be installed to run features or scenarios tagged with @Talk'); + } + } + + /** + * @AfterScenario @Talk + */ + public static function disableTalk() { + TalkContext::runOcc(['app:disable', 'spreed']); + } + + private static function isTalkInstalled(): bool { + $appList = TalkContext::runOcc(['app:list']); + + return strpos($appList, 'spreed') !== false; + } + + private static function runOcc(array $args): string { + // Based on "runOcc" from CommandLine trait (which can not be used due + // to not being static and being already used in other sibling + // contexts). + $args = array_map(function ($arg) { + return escapeshellarg($arg); + }, $args); + $args[] = '--no-ansi --no-warnings'; + $args = implode(' ', $args); + + $descriptor = [ + 0 => ['pipe', 'r'], + 1 => ['pipe', 'w'], + 2 => ['pipe', 'w'], + ]; + $process = proc_open('php console.php ' . $args, $descriptor, $pipes, $ocPath = '../..'); + $lastStdOut = stream_get_contents($pipes[1]); + proc_close($process); + + return $lastStdOut; + } +} diff --git a/build/integration/sharing_features/sharing-v1-video-verification.feature b/build/integration/sharing_features/sharing-v1-video-verification.feature new file mode 100644 index 00000000000..e57ec9a9f98 --- /dev/null +++ b/build/integration/sharing_features/sharing-v1-video-verification.feature @@ -0,0 +1,504 @@ +@Talk +Feature: sharing + Background: + Given using api version "1" + Given using old dav path + Given invoking occ with "app:enable spreed" + + Scenario: Creating a link share with send password by Talk + Given user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + | password | secret | + | sendPasswordByTalk | true | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Enabling send password by Talk in a link share + Given user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + And Updating last share with + | password | secret | + | sendPasswordByTalk | true | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Enabling send password by Talk with different password in a link share + Given user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + | password | secret | + And Updating last share with + | password | another secret | + | sendPasswordByTalk | true | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "another secret" can be downloaded + + Scenario: Enabling send password by Talk with different password set after creation in a link share + Given user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + And Updating last share with + | password | secret | + And Updating last share with + | password | another secret | + | sendPasswordByTalk | true | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "another secret" can be downloaded + + Scenario: Enabling send password by Talk with same password in a link share + Given user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + | password | secret | + And Updating last share with + | password | secret | + | sendPasswordByTalk | true | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Enabling send password by Talk with same password set after creation in a link share + Given user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + And Updating last share with + | password | secret | + And Updating last share with + | password | secret | + | sendPasswordByTalk | true | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Enabling send password by Talk without updating password in a link share + Given user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + | password | secret | + And Updating last share with + | sendPasswordByTalk | true | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Enabling send password by Talk without updating password set after creation in a link share + Given user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + And Updating last share with + | password | secret | + And Updating last share with + | sendPasswordByTalk | true | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Enabling send password by Talk with no password in a link share + Given user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + And Updating last share with + | sendPasswordByTalk | true | + Then the OCS status code should be "400" + And the HTTP status code should be "200" + And last share can be downloaded + + Scenario: Enabling send password by Talk with no password removed after creation in a link share + Given user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + | password | secret | + And Updating last share with + | password | | + And Updating last share with + | sendPasswordByTalk | true | + Then the OCS status code should be "400" + And the HTTP status code should be "200" + And last share can be downloaded + + Scenario: Disabling send password by Talk without setting new password in a link share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + | password | secret | + | sendPasswordByTalk | true | + And Updating last share with + | sendPasswordByTalk | false | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Disabling send password by Talk without setting new password set after creation in a link share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + And Updating last share with + | password | secret | + | sendPasswordByTalk | true | + And Updating last share with + | sendPasswordByTalk | false | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Disabling send password by Talk setting same password in a link share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + | password | secret | + | sendPasswordByTalk | true | + And Updating last share with + | password | secret | + | sendPasswordByTalk | false | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Disabling send password by Talk setting same password set after creation in a link share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + And Updating last share with + | password | secret | + | sendPasswordByTalk | true | + And Updating last share with + | password | secret | + | sendPasswordByTalk | false | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Disabling send password by Talk setting new password in a link share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + | password | secret | + | sendPasswordByTalk | true | + And Updating last share with + | password | another secret | + | sendPasswordByTalk | false | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "another secret" can be downloaded + + Scenario: Disabling send password by Talk setting new password set after creation in a link share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + And Updating last share with + | password | secret | + | sendPasswordByTalk | true | + And Updating last share with + | password | another secret | + | sendPasswordByTalk | false | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "another secret" can be downloaded + + + + + + Scenario: Creating a mail share with send password by Talk + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + | password | secret | + | sendPasswordByTalk | true | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Enabling send password by Talk in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + And Updating last share with + | password | secret | + | sendPasswordByTalk | true | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Enabling send password by Talk with different password in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + | password | secret | + And Updating last share with + | password | another secret | + | sendPasswordByTalk | true | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "another secret" can be downloaded + + Scenario: Enabling send password by Talk with different password set after creation in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + And Updating last share with + | password | secret | + And Updating last share with + | password | another secret | + | sendPasswordByTalk | true | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "another secret" can be downloaded + + Scenario: Enabling send password by Talk with same password in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + | password | secret | + And Updating last share with + | password | secret | + | sendPasswordByTalk | true | + Then the OCS status code should be "400" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Enabling send password by Talk with same password set after creation in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + And Updating last share with + | password | secret | + And Updating last share with + | password | secret | + | sendPasswordByTalk | true | + Then the OCS status code should be "400" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Enabling send password by Talk without updating password in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + | password | secret | + And Updating last share with + | sendPasswordByTalk | true | + Then the OCS status code should be "400" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Enabling send password by Talk without updating password set after creation in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + And Updating last share with + | password | secret | + And Updating last share with + | sendPasswordByTalk | true | + Then the OCS status code should be "400" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Enabling send password by Talk with no password in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + And Updating last share with + | sendPasswordByTalk | true | + Then the OCS status code should be "400" + And the HTTP status code should be "200" + And last share can be downloaded + + Scenario: Enabling send password by Talk with no password removed after creation in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + | password | secret | + And Updating last share with + | password | | + And Updating last share with + | sendPasswordByTalk | true | + Then the OCS status code should be "400" + And the HTTP status code should be "200" + And last share can be downloaded + + Scenario: Disabling send password by Talk without setting new password in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + | password | secret | + | sendPasswordByTalk | true | + And Updating last share with + | sendPasswordByTalk | false | + Then the OCS status code should be "400" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Disabling send password by Talk without setting new password set after creation in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + And Updating last share with + | password | secret | + | sendPasswordByTalk | true | + And Updating last share with + | sendPasswordByTalk | false | + Then the OCS status code should be "400" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Disabling send password by Talk setting same password in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + | password | secret | + | sendPasswordByTalk | true | + And Updating last share with + | password | secret | + | sendPasswordByTalk | false | + Then the OCS status code should be "400" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Disabling send password by Talk setting same password set after creation in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + And Updating last share with + | password | secret | + | sendPasswordByTalk | true | + And Updating last share with + | password | secret | + | sendPasswordByTalk | false | + Then the OCS status code should be "400" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Disabling send password by Talk setting new password in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + | password | secret | + | sendPasswordByTalk | true | + And Updating last share with + | password | another secret | + | sendPasswordByTalk | false | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "another secret" can be downloaded + + Scenario: Disabling send password by Talk setting new password set after creation in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + And Updating last share with + | password | secret | + | sendPasswordByTalk | true | + And Updating last share with + | password | another secret | + | sendPasswordByTalk | false | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "another secret" can be downloaded diff --git a/build/integration/sharing_features/sharing-v1.feature b/build/integration/sharing_features/sharing-v1.feature index 51a627dc6de..764cd857a3e 100644 --- a/build/integration/sharing_features/sharing-v1.feature +++ b/build/integration/sharing_features/sharing-v1.feature @@ -56,6 +56,92 @@ Feature: sharing Then the OCS status code should be "403" And the HTTP status code should be "401" + Scenario: Creating a new mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dumy@test.com | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share can be downloaded + + Scenario: Creating a new mail share with password + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dumy@test.com | + | password | publicpw | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "publicpw" can be downloaded + + Scenario: Creating a new mail share with password when password protection is enforced + Given dummy mail server is listening + And As an "admin" + And parameter "enforcePasswordProtection" of app "sharebymail" is set to "yes" + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dumy@test.com | + | password | publicpw | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "publicpw" can be downloaded + + Scenario: Creating a new mail share and setting a password + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dumy@test.com | + And Updating last share with + | password | publicpw | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "publicpw" can be downloaded + + Scenario: Creating a new mail share and setting a password twice + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dumy@test.com | + And Updating last share with + | password | publicpw | + And Updating last share with + | password | another publicpw | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "another publicpw" can be downloaded + + Scenario: Creating a new mail share and setting the same password twice + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dumy@test.com | + And Updating last share with + | password | publicpw | + And Updating last share with + | password | publicpw | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "publicpw" can be downloaded + Scenario: Creating a new public share Given user "user0" exists And As an "user0" @@ -64,7 +150,7 @@ Feature: sharing | shareType | 3 | Then the OCS status code should be "100" And the HTTP status code should be "200" - And Public shared file "welcome.txt" can be downloaded + And last link share can be downloaded Scenario: Creating a new public share with password Given user "user0" exists @@ -75,7 +161,7 @@ Feature: sharing | password | publicpw | Then the OCS status code should be "100" And the HTTP status code should be "200" - And Public shared file "welcome.txt" with password "publicpw" can be downloaded + And last share with password "publicpw" can be downloaded Scenario: Creating a new public share of a folder Given user "user0" exists @@ -108,7 +194,7 @@ Feature: sharing | expireDate | +3 days | Then the OCS status code should be "100" And the HTTP status code should be "200" - And Public shared file "welcome.txt" with password "publicpw" can be downloaded + And last share with password "publicpw" can be downloaded Scenario: Creating a new public share, updating its expiration date and getting its info Given user "user0" exists |