summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-08-13 10:13:21 +0200
committerVincent Petry <pvince81@owncloud.com>2015-08-13 10:13:21 +0200
commit55dc74bba48704cc2478530300aece9396b7b191 (patch)
tree232d162e9dd71f3f50e6c943a35340ea72c07893 /apps/files_sharing/tests
parentb811124aac3cf308b5c011d4c32554d145fe4d10 (diff)
parent77b6e3d5ec8a5bf6ae0fd3cbb24486ee828c5d89 (diff)
downloadnextcloud-server-55dc74bba48704cc2478530300aece9396b7b191.tar.gz
nextcloud-server-55dc74bba48704cc2478530300aece9396b7b191.zip
Merge pull request #16543 from rullzer/files_sharing_proper_function_args
files_sharing private function to proper signature
Diffstat (limited to 'apps/files_sharing/tests')
-rw-r--r--apps/files_sharing/tests/api.php48
1 files changed, 48 insertions, 0 deletions
diff --git a/apps/files_sharing/tests/api.php b/apps/files_sharing/tests/api.php
index af441b38ff2..3bd568e47af 100644
--- a/apps/files_sharing/tests/api.php
+++ b/apps/files_sharing/tests/api.php
@@ -307,6 +307,31 @@ class Test_Files_Sharing_Api extends TestCase {
\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2);
}
+ function testGetAllSharesWithMe() {
+ $fileinfo1 = $this->view->getFileInfo($this->filename);
+ $fileinfo2 = $this->view->getFileInfo($this->folder.$this->filename);
+
+ \OCP\Share::shareItem('file', $fileinfo1['fileid'], \OCP\Share::SHARE_TYPE_USER,
+ \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2, 31);
+ \OCP\Share::shareItem('folder', $fileinfo2['fileid'], \OCP\Share::SHARE_TYPE_USER,
+ \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2, 31);
+
+ self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
+
+ $_GET['shared_with_me'] = 1;
+ $result = \OCA\Files_Sharing\API\Local::getAllShares(array());
+
+ $this->assertTrue($result->succeeded());
+ $this->assertTrue(count($result->getData()) === 2);
+
+ self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
+
+ \OCP\Share::unshare('file', $fileinfo1['fileid'], \OCP\Share::SHARE_TYPE_USER,
+ \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2);
+ \OCP\Share::unshare('folder', $fileinfo2['fileid'], \OCP\Share::SHARE_TYPE_USER,
+ \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2);
+ }
+
/**
* @medium
* @depends testCreateShare
@@ -506,7 +531,30 @@ class Test_Files_Sharing_Api extends TestCase {
\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2);
\OCP\Share::unshare('folder', $fileInfo2['fileid'], \OCP\Share::SHARE_TYPE_LINK, null);
+ }
+
+ function testGetShareFromFolderWithFile() {
+ $fileInfo1 = $this->view->getFileInfo($this->filename);
+
+ $result = \OCP\Share::shareItem('file', $fileInfo1['fileid'], \OCP\Share::SHARE_TYPE_USER,
+ \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2, 31);
+
+ // share was successful?
+ $this->assertTrue($result);
+
+ $_GET = [
+ 'path' => $this->filename,
+ 'subfiles' => 1
+ ];
+ $result = \OCA\Files_Sharing\API\Local::getAllShares([]);
+
+ $this->assertFalse($result->succeeded());
+ $this->assertEquals(400, $result->getStatusCode());
+ $this->assertEquals('not a directory', $result->getMeta()['message']);
+
+ \OCP\Share::unshare('file', $fileInfo1['fileid'], \OCP\Share::SHARE_TYPE_USER,
+ \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2);
}
/**