From 86e4720c3ea8b01b198b9c3fb7cb565c78b71491 Mon Sep 17 00:00:00 2001 From: Sergio Bertolin Date: Wed, 29 Mar 2017 16:43:02 +0000 Subject: [PATCH] Added test to check that public shares are gone when the file is deleted --- .../features/bootstrap/Sharing.php | 7 +++ tests/integration/features/sharing-v1.feature | 57 +++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/tests/integration/features/bootstrap/Sharing.php b/tests/integration/features/bootstrap/Sharing.php index 034f98ff8a..4414593d49 100644 --- a/tests/integration/features/bootstrap/Sharing.php +++ b/tests/integration/features/bootstrap/Sharing.php @@ -542,6 +542,13 @@ trait Sharing { if ($TableNode instanceof \Behat\Gherkin\Node\TableNode) { $elementRows = $TableNode->getRows(); + + if ($elementRows[0][0] === '') { + //It shouldn't have public shares + PHPUnit_Framework_Assert::assertEquals(count($dataResponded), 0); + return 0; + } + foreach($elementRows as $expectedElementsArray) { //0 path, 1 permissions, 2 name $nameFound = false; diff --git a/tests/integration/features/sharing-v1.feature b/tests/integration/features/sharing-v1.feature index a644b1ce82..26c48ab02c 100644 --- a/tests/integration/features/sharing-v1.feature +++ b/tests/integration/features/sharing-v1.feature @@ -1241,3 +1241,60 @@ Feature: sharing | /textfile0.txt | 1 | sharedlink2 | | /textfile0.txt | 1 | sharedlink1 | | /textfile0.txt | 1 | sharedlink3 | + + Scenario: Check that updating password doesn't remove name of links + Given user "user0" exists + And As an "user0" + And creating a share with + | path | FOLDER | + | shareType | 3 | + | password | publicpw | + | expireDate | +3 days | + | publicUpload | true | + | permissions | 15 | + | name | sharedlink1 | + And the OCS status code should be "100" + And the HTTP status code should be "200" + And creating a share with + | path | FOLDER | + | shareType | 3 | + | password | publicpw | + | expireDate | +3 days | + | publicUpload | true | + | permissions | 15 | + | name | sharedlink2 | + And the OCS status code should be "100" + And the HTTP status code should be "200" + When Updating last share with + | password | newpassword | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And user "user0" checks public shares of folder "/FOLDER" + | /FOLDER | 15 | sharedlink2 | + | /FOLDER | 15 | sharedlink1 | + + Scenario: Deleting a file deletes also its public links + Given user "user0" exists + And As an "user0" + And creating a share with + | path | textfile0.txt | + | shareType | 3 | + | password | publicpw | + | expireDate | +3 days | + | permissions | 1 | + | name | sharedlink1 | + And the OCS status code should be "100" + And the HTTP status code should be "200" + And creating a share with + | path | textfile0.txt | + | shareType | 3 | + | password | publicpw | + | expireDate | +3 days | + | permissions | 1 | + | name | sharedlink2 | + And User "user0" deletes file "/textfile0.txt" + And the HTTP status code should be "204" + When User "user0" uploads file "data/textfile.txt" to "/textfile0.txt" + Then the HTTP status code should be "201" + And user "user0" checks public shares of file "/textfile0.txt" + | | | | -- GitLab