[Pkg-owncloud-commits] [owncloud] 11/16: Added encryption test when moving file as non-owner

David Prévot taffit at moszumanska.debian.org
Thu Oct 30 19:56:00 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit a1ded6e9d746d08630641e79ad11e6f31dfda9d9
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Wed Oct 29 12:57:12 2014 +0100

    Added encryption test when moving file as non-owner
---
 apps/files_encryption/tests/share.php | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/apps/files_encryption/tests/share.php b/apps/files_encryption/tests/share.php
index f426ecd..a55a4d4 100755
--- a/apps/files_encryption/tests/share.php
+++ b/apps/files_encryption/tests/share.php
@@ -1075,8 +1075,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();
@@ -1109,8 +1120,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);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list