summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-10-29 12:57:12 +0100
committerVincent Petry <pvince81@owncloud.com>2014-10-29 12:57:12 +0100
commite8f9b929bd04c4228299118a5cca72148d64fed2 (patch)
tree206593b59537196c11993846d9dae19648ea69ab /apps
parentf44e617dfdf79cedba4700bfb8e21ac9c51bb624 (diff)
downloadnextcloud-server-e8f9b929bd04c4228299118a5cca72148d64fed2.tar.gz
nextcloud-server-e8f9b929bd04c4228299118a5cca72148d64fed2.zip
Added encryption test when moving file as non-owner
Diffstat (limited to 'apps')
-rwxr-xr-xapps/files_encryption/tests/share.php17
1 files changed, 15 insertions, 2 deletions
diff --git a/apps/files_encryption/tests/share.php b/apps/files_encryption/tests/share.php
index f4ce94b7ee9..4a0f10b13fb 100755
--- a/apps/files_encryption/tests/share.php
+++ b/apps/files_encryption/tests/share.php
@@ -1074,8 +1074,19 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase {
\OC\Files\Filesystem::unlink('/newfolder');
}
- function testMoveFileToFolder() {
+ function usersProvider() {
+ return array(
+ // test as owner
+ array(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1),
+ // test as share receiver
+ array(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2),
+ );
+ }
+ /**
+ * @dataProvider usersProvider
+ */
+ function testMoveFileToFolder($userId) {
$view = new \OC\Files\View('/' . \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1);
$filename = '/tmp-' . uniqid();
@@ -1108,8 +1119,10 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase {
$this->assertTrue($view->file_exists('files_encryption/share-keys' . $folder . '/' . $filename . '.' . \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1 . '.shareKey'));
$this->assertTrue($view->file_exists('files_encryption/share-keys' . $folder . '/' . $filename . '.' . \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2 . '.shareKey'));
- // move the file into the subfolder
+ // move the file into the subfolder as the test user
+ \Test_Encryption_Util::loginHelper($userId);
\OC\Files\Filesystem::rename($folder . $filename, $subFolder . $filename);
+ \Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1);
// Get file decrypted contents
$newDecrypt = \OC\Files\Filesystem::file_get_contents($subFolder . $filename);