summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/tests
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-06-24 14:00:15 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2014-06-24 14:00:15 +0200
commit3fc7357adea018878f5e1d41ea3c77d34ed73a98 (patch)
treec76a214f7f1f187d903a0665244a488f7c4dabe3 /apps/files_sharing/tests
parent70ca292fd9c74a6f78983ae252729ee6fa69b1f4 (diff)
downloadnextcloud-server-3fc7357adea018878f5e1d41ea3c77d34ed73a98.tar.gz
nextcloud-server-3fc7357adea018878f5e1d41ea3c77d34ed73a98.zip
add/update unit tests
Diffstat (limited to 'apps/files_sharing/tests')
-rw-r--r--apps/files_sharing/tests/permissions.php5
-rw-r--r--apps/files_sharing/tests/sharedstorage.php31
2 files changed, 33 insertions, 3 deletions
diff --git a/apps/files_sharing/tests/permissions.php b/apps/files_sharing/tests/permissions.php
index 2cbc412d261..299e471a3fd 100644
--- a/apps/files_sharing/tests/permissions.php
+++ b/apps/files_sharing/tests/permissions.php
@@ -145,10 +145,9 @@ class Test_Files_Sharing_Permissions extends Test_Files_Sharing_Base {
$this->assertEquals(27, $contents[1]['permissions']);
$contents = $this->secondView->getDirectoryContent('files/shareddirrestricted');
$this->assertEquals('subdir', $contents[0]['name']);
- $this->assertEquals(7 | \OCP\PERMISSION_DELETE, $contents[0]['permissions']);
+ $this->assertEquals(7, $contents[0]['permissions']);
$this->assertEquals('textfile1.txt', $contents[1]['name']);
// 3 is correct because create is reserved to folders only
- // delete permissions are added since mount points can always be deleted
- $this->assertEquals(3 | \OCP\PERMISSION_DELETE, $contents[1]['permissions']);
+ $this->assertEquals(3, $contents[1]['permissions']);
}
}
diff --git a/apps/files_sharing/tests/sharedstorage.php b/apps/files_sharing/tests/sharedstorage.php
index b80ab6b4f14..27f3b5150d5 100644
--- a/apps/files_sharing/tests/sharedstorage.php
+++ b/apps/files_sharing/tests/sharedstorage.php
@@ -166,4 +166,35 @@ class Test_Files_Sharing_Storage extends Test_Files_Sharing_Base {
$this->assertTrue($result);
}
+ function testGetPermissions() {
+ $fileinfoFolder = $this->view->getFileInfo($this->folder);
+
+ $result = \OCP\Share::shareItem('folder', $fileinfoFolder['fileid'], \OCP\Share::SHARE_TYPE_USER,
+ self::TEST_FILES_SHARING_API_USER2, 1);
+ $this->assertTrue($result);
+
+ self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
+
+ $this->assertTrue(\OC\Files\Filesystem::is_dir($this->folder));
+
+ // for the share root we expect:
+ // the shared permissions (1)
+ // the delete permission (8), to enable unshare
+ // the update permission (2), to allow renaming of the mount point
+ $rootInfo = \OC\Files\Filesystem::getFileInfo($this->folder);
+ $this->assertSame(11, $rootInfo->getPermissions());
+
+ // for the file within the shared folder we expect:
+ // the shared permissions (1)
+ $subfileInfo = \OC\Files\Filesystem::getFileInfo($this->folder . $this->filename);
+ $this->assertSame(1, $subfileInfo->getPermissions());
+
+
+ //cleanup
+ self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
+ $result = \OCP\Share::unshare('folder', $fileinfoFolder['fileid'], \OCP\Share::SHARE_TYPE_USER,
+ self::TEST_FILES_SHARING_API_USER2);
+ $this->assertTrue($result);
+ }
+
}