From e72955c65d82cd30b63b116eebd19639b4de496e Mon Sep 17 00:00:00 2001 From: Sergio Bertolin Date: Wed, 2 Dec 2015 11:44:03 +0000 Subject: [PATCH 1/3] Added shared by multiple channels test * Small changes plus check of the file using propfind * Restaured line removed accidentally --- .../integration/features/bootstrap/WebDav.php | 12 +++++++++++ build/integration/features/sharing-v1.feature | 20 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index a682467f52d..37e8e4ec474 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -153,5 +153,17 @@ trait WebDav{ } } + /** + * @Given User :user created a folder :destination + */ + public function userCreatedAFolder($user, $destination){ + try { + $this->response = $this->makeDavRequest($user, "MKCOL", $destination, []); + } catch (\GuzzleHttp\Exception\ServerException $e) { + // 4xx and 5xx responses cause an exception + $this->response = $e->getResponse(); + } + } + } diff --git a/build/integration/features/sharing-v1.feature b/build/integration/features/sharing-v1.feature index e00fd47baeb..15db0b461b4 100644 --- a/build/integration/features/sharing-v1.feature +++ b/build/integration/features/sharing-v1.feature @@ -379,6 +379,26 @@ Feature: sharing | /CHILD/child.txt | And the HTTP status code should be "200" + Scenario: Share a file by multiple channels + Given As an "admin" + And user "user0" exists + And user "user1" exists + And user "user2" exists + And group "group0" exists + And user "user1" belongs to group "group0" + And user "user2" belongs to group "group0" + And user "user0" created a folder "/common" + And user "user0" created a folder "/common/sub" + And file "common" of user "user0" is shared with group "group0" + And file "textfile0.txt" of user "user1" is shared with user "user2" + And User "user1" moved file "/textfile0.txt" to "/common/textfile0.txt" + And User "user1" moved file "/common/textfile0.txt" to "/common/sub/textfile0.txt" + And As an "user2" + When Downloading file "/common/sub/textfile0.txt" with range "bytes=9-17" + Then Downloaded content should be "test text" + And user "user2" should see following elements + | /common/sub/textfile0.txt | + Scenario: Delete all group shares Given As an "admin" And user "user0" exists From 1d7a2aa9f97c00a3019214a08694fa583d29d5fb Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Mon, 7 Dec 2015 15:03:40 +0100 Subject: [PATCH 2/3] Folder depth needs to be at least 3 for all tests to pass --- build/integration/features/bootstrap/WebDav.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index 37e8e4ec474..d88447d41a6 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -126,7 +126,7 @@ trait WebDav{ * @param \Behat\Gherkin\Node\TableNode|null $expectedElements */ public function checkElementList($user, $expectedElements){ - $elementList = $this->listFolder($user, '/', 2); + $elementList = $this->listFolder($user, '/', 3); if ($expectedElements instanceof \Behat\Gherkin\Node\TableNode) { $elementRows = $expectedElements->getRows(); $elementsSimplified = $this->simplifyArray($elementRows); From 93f4524a9135d52abdf6fd3ba2962aa5a581aa68 Mon Sep 17 00:00:00 2001 From: Sergio Bertolin Date: Wed, 9 Dec 2015 12:56:03 +0000 Subject: [PATCH 3/3] Added check for /textfile0.txt --- .../integration/features/bootstrap/WebDav.php | 9 ++++++++ build/integration/features/sharing-v1.feature | 23 ++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index d88447d41a6..49cd565cf26 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -97,6 +97,15 @@ trait WebDav{ PHPUnit_Framework_Assert::assertEquals($content, (string)$this->response->getBody()); } + /** + * @Then /^Downloaded content when downloading file "([^"]*)" with range "([^"]*)" should be "([^"]*)"$/ + */ + public function downloadedContentWhenDownloadindShouldBe($fileSource, $range, $content){ + $this->downloadFileWithRange($fileSource, $range); + $this->downloadedContentShouldBe($content); + } + + /*Returns the elements of a propfind, $folderDepth requires 1 to see elements without children*/ public function listFolder($user, $path, $folderDepth){ $fullUrl = substr($this->baseUrl, 0, -4); diff --git a/build/integration/features/sharing-v1.feature b/build/integration/features/sharing-v1.feature index 15db0b461b4..31ba0d4ad7f 100644 --- a/build/integration/features/sharing-v1.feature +++ b/build/integration/features/sharing-v1.feature @@ -379,7 +379,7 @@ Feature: sharing | /CHILD/child.txt | And the HTTP status code should be "200" - Scenario: Share a file by multiple channels + Scenario: Share a file by multiple channels Given As an "admin" And user "user0" exists And user "user1" exists @@ -396,6 +396,27 @@ Feature: sharing And As an "user2" When Downloading file "/common/sub/textfile0.txt" with range "bytes=9-17" Then Downloaded content should be "test text" + And Downloaded content when downloading file "/textfile0.txt" with range "bytes=9-17" should be "test text" + And user "user2" should see following elements + | /common/sub/textfile0.txt | + + Scenario: Share a file by multiple channels + Given As an "admin" + And user "user0" exists + And user "user1" exists + And user "user2" exists + And group "group0" exists + And user "user1" belongs to group "group0" + And user "user2" belongs to group "group0" + And user "user0" created a folder "/common" + And user "user0" created a folder "/common/sub" + And file "common" of user "user0" is shared with group "group0" + And file "textfile0.txt" of user "user1" is shared with user "user2" + And User "user1" moved file "/textfile0.txt" to "/common/textfile0.txt" + And User "user1" moved file "/common/textfile0.txt" to "/common/sub/textfile0.txt" + And As an "user2" + When Downloading file "/textfile0.txt" with range "bytes=9-17" + Then Downloaded content should be "test text" And user "user2" should see following elements | /common/sub/textfile0.txt |