diff options
author | Björn Schießle <schiessle@owncloud.com> | 2014-04-15 11:23:17 +0200 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2014-04-15 11:23:17 +0200 |
commit | 2dbb2db7e0ca1e1f5c32de4b6e47c0c9c870acc3 (patch) | |
tree | 58783d31bf04451896d0cbe0b83edb889481e2d5 /apps | |
parent | 1ea8b644b63fe48dbb515b2fdc960225804de068 (diff) | |
parent | 7dafdfbe88e713a3f3e03e142679fd840deed494 (diff) | |
download | nextcloud-server-2dbb2db7e0ca1e1f5c32de4b6e47c0c9c870acc3.tar.gz nextcloud-server-2dbb2db7e0ca1e1f5c32de4b6e47c0c9c870acc3.zip |
Merge pull request #7780 from owncloud/share-file-exists
Verify that a file exists before we share it
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/tests/api.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/apps/files_sharing/tests/api.php b/apps/files_sharing/tests/api.php index e3c5b6e4315..c7a848315ac 100644 --- a/apps/files_sharing/tests/api.php +++ b/apps/files_sharing/tests/api.php @@ -878,6 +878,29 @@ class Test_Files_Sharing_Api extends Test_Files_Sharing_Base { $this->assertSame($expectedResult, $shareApiDummy->correctPathTest($path, $folder)); } + /** + * @expectedException \Exception + */ + public function testShareNonExisting() { + \Test_Files_Sharing_Api::loginHelper(\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER1); + + $id = PHP_INT_MAX - 1; + \OCP\Share::shareItem('file', $id, \OCP\Share::SHARE_TYPE_LINK, \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2, 31); + } + + /** + * @expectedException \Exception + */ + public function testShareNotOwner() { + \Test_Files_Sharing_Api::loginHelper(\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2); + \OC\Files\Filesystem::file_put_contents('foo.txt', 'bar'); + $info = \OC\Files\Filesystem::getFileInfo('foo.txt'); + + \Test_Files_Sharing_Api::loginHelper(\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER1); + + \OCP\Share::shareItem('file', $info->getId(), \OCP\Share::SHARE_TYPE_LINK, \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2, 31); + } + } /** |