aboutsummaryrefslogtreecommitdiffstats
path: root/build/integration/features/bootstrap/Sharing.php
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2016-02-18 23:07:41 +0100
committerLukas Reschke <lukas@owncloud.com>2016-02-19 18:08:34 +0100
commit16be9af20ad99a62bcf3552a7cfd0ebe807edfe3 (patch)
tree5f663fd48c770703ec32d3fbfed985c750b43def /build/integration/features/bootstrap/Sharing.php
parent32e4256945e721d79aacefa3b880c57d16124f7f (diff)
downloadnextcloud-server-16be9af20ad99a62bcf3552a7cfd0ebe807edfe3.tar.gz
nextcloud-server-16be9af20ad99a62bcf3552a7cfd0ebe807edfe3.zip
Add integration tests for comments
This adds integration tests for the comments. Especially with regard to the permission handling, didn't find any problem in it. Fixes https://github.com/owncloud/core/issues/22367
Diffstat (limited to 'build/integration/features/bootstrap/Sharing.php')
-rw-r--r--build/integration/features/bootstrap/Sharing.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/build/integration/features/bootstrap/Sharing.php b/build/integration/features/bootstrap/Sharing.php
index 5103b4af508..faf8e0bf507 100644
--- a/build/integration/features/bootstrap/Sharing.php
+++ b/build/integration/features/bootstrap/Sharing.php
@@ -370,5 +370,49 @@ trait Sharing{
}
}
+ /**
+ * @Then As :user remove all shares from the file named :fileName
+ */
+ public function asRemoveAllSharesFromTheFileNamed($user, $fileName) {
+ $url = $this->baseUrl.'v2.php/apps/files_sharing/api/v1/shares?format=json';
+ $client = new \GuzzleHttp\Client();
+ $res = $client->get(
+ $url,
+ [
+ 'auth' => [
+ $user,
+ '123456',
+ ],
+ 'headers' => [
+ 'Content-Type' => 'application/json',
+ ],
+ ]
+ );
+ $json = json_decode($res->getBody()->getContents(), true);
+ $deleted = false;
+ foreach($json['ocs']['data'] as $data) {
+ if (stripslashes($data['path']) === $fileName) {
+ $id = $data['id'];
+ $client->delete(
+ $this->baseUrl.'v2.php/apps/files_sharing/api/v1/shares/'.$id,
+ [
+ 'auth' => [
+ $user,
+ '123456',
+ ],
+ 'headers' => [
+ 'Content-Type' => 'application/json',
+ ],
+ ]
+ );
+ $deleted = true;
+ }
+ }
+
+ if($deleted === false) {
+ throw new \Exception("Could not delete file $fileName");
+ }
+ }
+
}