]> source.dussan.org Git - nextcloud-server.git/commitdiff
cleanup unused code optimize tests
authorFlorin Peter <github@florin-peter.de>
Mon, 20 May 2013 22:00:55 +0000 (00:00 +0200)
committerFlorin Peter <github@florin-peter.de>
Mon, 20 May 2013 22:00:55 +0000 (00:00 +0200)
apps/files_encryption/appinfo/app.php
apps/files_encryption/lib/helper.php
apps/files_encryption/tests/share.php

index e56d012fee9600b035bfdb25432e145943f0b1df..7d01696e08a51a516553de81a0d2b544930afabf 100644 (file)
@@ -18,9 +18,6 @@ OCA\Encryption\Helper::registerUserHooks();
 // Sharing related hooks
 OCA\Encryption\Helper::registerShareHooks();
 
-// Webdav related hooks
-OCA\Encryption\Helper::registerWebdavHooks();
-
 // Filesystem related hooks
 OCA\Encryption\Helper::registerFilesystemHooks();
 
index c57f0bc0092b86b83fdb0926be7ab9fa9212a530..e4bf2c1226adc528d7b21c9ecc5b0f3bda1be1e8 100755 (executable)
@@ -58,16 +58,6 @@ class Helper
                \OCP\Util::connectHook('OC_User', 'post_deleteUser', 'OCA\Encryption\Hooks', 'postDeleteUser');
        }
 
-       /**
-        * @brief register webdav related hooks
-        *
-        */
-       public static function registerWebdavHooks()
-       {
-
-
-       }
-
        /**
         * @brief register filesystem related hooks
         *
index f302aa0a3ef4226be869d8176aef356bd5b05b7b..0b806394eb3be2e9ac086ede9bccc3b4b42650a9 100755 (executable)
@@ -557,8 +557,14 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase
 
        function testRecoveryFile()
        {
-               // login as admin
-               $this->loginHelper('admin');
+               // disable encryption proxy to prevent recursive calls
+               $proxyStatus = \OC_FileProxy::$enabled;
+               \OC_FileProxy::$enabled = false;
+
+               $this->view->unlink('/owncloud_private_key');
+               $this->view->unlink('/public-keys');
+
+               \OC_FileProxy::$enabled = $proxyStatus;
 
                \OCA\Encryption\Helper::adminEnableRecovery(null, 'test123');
                $recoveryKeyId = OC_Appconfig::getValue('files_encryption', 'recoveryKeyId');
@@ -566,6 +572,9 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase
                // check if control file created
                $this->assertTrue($this->view->file_exists('/control-file/controlfile.enc'));
 
+               // login as admin
+               $this->loginHelper('admin');
+
                $util = new \OCA\Encryption\Util(new \OC_FilesystemView('/'), 'admin');
 
                // check if recovery password match
@@ -620,6 +629,9 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase
                // check if share key for recovery not exists
                $this->assertFalse($this->view->file_exists('/admin/files_encryption/share-keys/' . $this->filename . '.' . $recoveryKeyId . '.shareKey'));
                $this->assertFalse($this->view->file_exists('/admin/files_encryption/share-keys/' . $this->folder1 . $this->subfolder . $this->subsubfolder . '/' . $this->filename . '.' . $recoveryKeyId . '.shareKey'));
+
+               \OCA\Encryption\Helper::adminDisableRecovery('test123');
+               $this->assertEquals(0, \OC_Appconfig::getValue('files_encryption', 'recoveryAdminEnabled'));
        }
 
        function testRecoveryForUser()
@@ -689,6 +701,9 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase
 
                // enable recovery for admin
                $this->assertTrue($util->setRecoveryForUser(0));
+
+               \OCA\Encryption\Helper::adminDisableRecovery('test123');
+               $this->assertEquals(0, \OC_Appconfig::getValue('files_encryption', 'recoveryAdminEnabled'));
        }
 
        function testFailShareFile()