diff --git a/tests/integration/features/bootstrap/Sharing.php b/tests/integration/features/bootstrap/Sharing.php index 4414593d4928093486b977667eaf6404b35c1317..d01d24fca3eedf970ce4c3679a4929cef38f6aa7 100644 --- a/tests/integration/features/bootstrap/Sharing.php +++ b/tests/integration/features/bootstrap/Sharing.php @@ -565,5 +565,28 @@ trait Sharing { } } + public function getPublicShareIDByName($user, $path, $name) { + $dataResponded = $this->getShares($user, $path); + foreach ($dataResponded as $elementResponded) { + if ((string)$elementResponded->name[0] === $name){ + return (int)$elementResponded->id[0]; + } + } + return null; + } + + /** + * @When /^user "([^"]*)" deletes public share named "([^"]*)" in (file|folder) "([^"]*)"$/ + * @param string $user + * @param string $name + * @param string $type + * @param string $path + */ + public function deletingPublicShareNamed($user, $name, $type, $path){ + $share_id = $this->getPublicShareIDByName($user, $path, $name); + $url = "/apps/files_sharing/api/v{$this->sharingApiVersion}/shares/$share_id"; + $this->sendingToWith("DELETE", $url, null); + } + } diff --git a/tests/integration/features/sharing-v1.feature b/tests/integration/features/sharing-v1.feature index 26c48ab02ce195087a137c11d2ae60c25377cb34..d98491038f51981a8f8b1f2278072cd8f0957603 100644 --- a/tests/integration/features/sharing-v1.feature +++ b/tests/integration/features/sharing-v1.feature @@ -1298,3 +1298,40 @@ Feature: sharing Then the HTTP status code should be "201" And user "user0" checks public shares of file "/textfile0.txt" | | | | + + Scenario: Creating three public shares of a file + 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 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 | sharedlink3 | + And the OCS status code should be "100" + And the HTTP status code should be "200" + When user "user0" deletes public share named "sharedlink2" in file "/textfile0.txt" + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And user "user0" checks public shares of file "/textfile0.txt" + | /textfile0.txt | 1 | sharedlink1 | + | /textfile0.txt | 1 | sharedlink3 |