diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2013-09-27 14:01:04 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2013-09-27 14:01:04 +0200 |
commit | 5b4f515e7bc0d2e74094b2caa94b130cf4ec1fda (patch) | |
tree | 2c5d71af59ad71289b188dc36be2f590c2e03912 /apps | |
parent | 62b8c36a40228192a936e823cda83c269147af91 (diff) | |
download | nextcloud-server-5b4f515e7bc0d2e74094b2caa94b130cf4ec1fda.tar.gz nextcloud-server-5b4f515e7bc0d2e74094b2caa94b130cf4ec1fda.zip |
add test getShareFromId
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/tests/api.php | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/apps/files_sharing/tests/api.php b/apps/files_sharing/tests/api.php index 475f203471e..51d5da5ac05 100644 --- a/apps/files_sharing/tests/api.php +++ b/apps/files_sharing/tests/api.php @@ -186,7 +186,7 @@ class Test_Files_Sharing_Api extends \PHPUnit_Framework_TestCase { * @medium * @depends testCreateShare */ - function testGetShare() { + function testGetShareFromSource() { $fileInfo = $this->view->getFileInfo($this->filename); @@ -216,6 +216,41 @@ class Test_Files_Sharing_Api extends \PHPUnit_Framework_TestCase { * @medium * @depends testCreateShare */ + function testGetShareFromId() { + + $fileInfo = $this->view->getFileInfo($this->filename); + + $result = \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, + \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2, 31); + + // share was successful? + $this->assertTrue($result); + + $result = \OCP\Share::getItemShared('file', $fileInfo['fileid']); + + $this->assertEquals(count($result), 1); + + // get first element + $share = reset($result); + + $params = array('id' => $share['id']); + + $result = Share\Api::getShare($params); + + $this->assertTrue($result->succeeded()); + + // test should return one share created from testCreateShare() + $this->assertEquals(count($result->getData()), 1); + + \OCP\Share::unshare('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, + \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2); + + } + + /** + * @medium + * @depends testCreateShare + */ function testUpdateShare() { $fileInfo = $this->view->getFileInfo($this->filename); |