Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorin Peter <github@florin-peter.de>2013-05-16 00:42:22 +0400
committerFlorin Peter <github@florin-peter.de>2013-05-16 00:42:22 +0400
commitb75a0abb6bee24b3f6e8276d129af3271a05e5d1 (patch)
tree3a585af7c777092cccf73e035f470e87b52d64f2 /apps/files_encryption/tests/crypt.php
parentec2e193a4413fa2d02ab6d127b1697294330e2bf (diff)
added test for rename folder
Diffstat (limited to 'apps/files_encryption/tests/crypt.php')
-rwxr-xr-xapps/files_encryption/tests/crypt.php36
1 files changed, 34 insertions, 2 deletions
diff --git a/apps/files_encryption/tests/crypt.php b/apps/files_encryption/tests/crypt.php
index f84536aaa13..6168f69415e 100755
--- a/apps/files_encryption/tests/crypt.php
+++ b/apps/files_encryption/tests/crypt.php
@@ -690,6 +690,38 @@ class Test_Crypt extends \PHPUnit_Framework_TestCase {
$view->unlink( $newFolder );
}
+ function testRenameFolder() {
+
+ $filename = '/tmp-'.time();
+
+ $folder = '/folder';
+ $newFolder = '/newfolder';
+ $view = new \OC\Files\View('/' . $this->userId . '/files');
+ $view->mkdir($folder);
+
+ // Save long data as encrypted file using stream wrapper
+ $cryptedFile = file_put_contents( 'crypt://' . $folder . $filename, $this->dataLong );
+
+ // Test that data was successfully written
+ $this->assertTrue( is_int( $cryptedFile ) );
+
+ // Get file decrypted contents
+ $decrypt = file_get_contents( 'crypt://' . $folder . $filename );
+
+ $this->assertEquals( $this->dataLong, $decrypt );
+
+ // rename folder
+ $view->rename($folder, $newFolder);
+
+ // Get file decrypted contents
+ $newDecrypt = file_get_contents( 'crypt://' . $newFolder . $filename );
+
+ $this->assertEquals( $this->dataLong, $newDecrypt );
+
+ // tear down
+ $view->unlink( $newFolder );
+ }
+
function testChangePassphrase() {
$filename = 'tmp-'.time();
@@ -706,7 +738,7 @@ class Test_Crypt extends \PHPUnit_Framework_TestCase {
$this->assertEquals( $this->dataLong, $decrypt );
// change password
- \OC_User::setPassword('admin', 'test');
+ \OC_User::setPassword($this->userId, 'test');
// relogin
$params['uid'] = $this->userId;
@@ -720,7 +752,7 @@ class Test_Crypt extends \PHPUnit_Framework_TestCase {
// tear down
// change password back
- \OC_User::setPassword('admin', 'admin');
+ \OC_User::setPassword($this->userId, $this->pass);
$view = new \OC\Files\View('/' . $this->userId . '/files');
$view->unlink( $filename );
}