diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-04-15 15:48:54 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-04-23 12:54:26 +0200 |
commit | d468cdacf27acf1de78a7b2f07d21d1851aa8f39 (patch) | |
tree | 0cd75287a9efab81258278784fd846c7188f536a /apps/files_sharing/tests/api.php | |
parent | 652d417a585ede1564456c446577aa1752253ccd (diff) | |
download | nextcloud-server-d468cdacf27acf1de78a7b2f07d21d1851aa8f39.tar.gz nextcloud-server-d468cdacf27acf1de78a7b2f07d21d1851aa8f39.zip |
add unit tests which got lost during rebase
Diffstat (limited to 'apps/files_sharing/tests/api.php')
-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 5975eb95882..b2f05d10ac6 100644 --- a/apps/files_sharing/tests/api.php +++ b/apps/files_sharing/tests/api.php @@ -928,4 +928,27 @@ class Test_Files_Sharing_Api extends Test_Files_Sharing_Base { \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2); } + /** + * @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); + } + } |