diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-03-10 11:16:09 +0100 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-03-10 11:35:54 +0100 |
commit | 9548670da76b15ca4e44df63304a11364dde44a0 (patch) | |
tree | d353e7831482803f3a7927a4d74d556abfed2cdf /apps/files_sharing/tests/api.php | |
parent | 536c33895f3e721492e30b19e02e4f1889207d34 (diff) | |
download | nextcloud-server-9548670da76b15ca4e44df63304a11364dde44a0.tar.gz nextcloud-server-9548670da76b15ca4e44df63304a11364dde44a0.zip |
we need the file_source to delete a share successfully
Diffstat (limited to 'apps/files_sharing/tests/api.php')
-rw-r--r-- | apps/files_sharing/tests/api.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/apps/files_sharing/tests/api.php b/apps/files_sharing/tests/api.php index 0d3d9b98b2e..073e2dd8c50 100644 --- a/apps/files_sharing/tests/api.php +++ b/apps/files_sharing/tests/api.php @@ -559,4 +559,38 @@ class Test_Files_Sharing_Api extends Test_Files_Sharing_Base { $this->assertTrue(empty($itemsAfterDelete)); } + + /** + * @brief test unshare of a reshared file + */ + function testDeleteReshare() { + + // user 1 shares a folder with user2 + \Test_Files_Sharing_Api::loginHelper(\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER1); + + $fileInfo1 = $this->view->getFileInfo($this->folder); + $fileInfo2 = $this->view->getFileInfo($this->folder.'/'.$this->filename); + + $result1 = \OCP\Share::shareItem('folder', $fileInfo1['fileid'], \OCP\Share::SHARE_TYPE_USER, + \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2, 31); + + $this->assertTrue($result1); + + // user2 shares a file from the folder as link + \Test_Files_Sharing_Api::loginHelper(\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2); + + $result2 = \OCP\Share::shareItem('file', $fileInfo2['fileid'], \OCP\Share::SHARE_TYPE_LINK, null, 1); + + $this->assertTrue(is_string($result2)); + + // test if we can unshare the link again + $items = \OCP\Share::getItemShared('file', null); + $this->assertEquals(1, count($items)); + + $item = reset($items); + $result3 = Share\Api::deleteShare(array('id' => $item['id'])); + + $this->assertTrue($result3->succeeded()); + + } } |