summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2015-06-24 12:37:24 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2015-06-25 08:39:01 +0200
commitcc0b1e4bf650baa5290aed05f954b0ef785c90c8 (patch)
tree3e276bcde7b7c022b389f5a21c3fd748a2820075 /apps
parent1c368754299495a173ffef01725b6e1c763f7af2 (diff)
downloadnextcloud-server-cc0b1e4bf650baa5290aed05f954b0ef785c90c8.tar.gz
nextcloud-server-cc0b1e4bf650baa5290aed05f954b0ef785c90c8.zip
Added unit test to verify link password removeal
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/tests/api.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/apps/files_sharing/tests/api.php b/apps/files_sharing/tests/api.php
index 232fcf28cd3..0b8778d185d 100644
--- a/apps/files_sharing/tests/api.php
+++ b/apps/files_sharing/tests/api.php
@@ -851,7 +851,6 @@ class Test_Files_Sharing_Api extends TestCase {
$this->assertEquals('1', $newUserShare['permissions']);
// update password for link share
-
$this->assertTrue(empty($linkShare['share_with']));
$params = array();
@@ -876,6 +875,29 @@ class Test_Files_Sharing_Api extends TestCase {
$this->assertTrue(is_array($newLinkShare));
$this->assertTrue(!empty($newLinkShare['share_with']));
+ // Remove password for link share
+ $params = array();
+ $params['id'] = $linkShare['id'];
+ $params['_put'] = array();
+ $params['_put']['password'] = '';
+
+ $result = \OCA\Files_Sharing\API\Local::updateShare($params);
+
+ $this->assertTrue($result->succeeded());
+
+ $items = \OCP\Share::getItemShared('file', $linkShare['file_source']);
+
+ $newLinkShare = null;
+ foreach ($items as $item) {
+ if ($item['share_type'] === \OCP\Share::SHARE_TYPE_LINK) {
+ $newLinkShare = $item;
+ break;
+ }
+ }
+
+ $this->assertTrue(is_array($newLinkShare));
+ $this->assertTrue(empty($newLinkShare['share_with']));
+
\OCP\Share::unshare('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER,
\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2);