diff options
author | Florin Peter <github@florin-peter.de> | 2013-05-17 01:07:26 +0200 |
---|---|---|
committer | Florin Peter <github@florin-peter.de> | 2013-05-17 01:07:26 +0200 |
commit | a4c0eb17569457784faa06ed0b65a319f7ec2f78 (patch) | |
tree | 4f1df6edd3b0f3e8405638c087d2b2bf09a076f5 /apps/files_encryption/tests/keymanager.php | |
parent | 42b4963dd010830d1a99666052ee2bfc7295249a (diff) | |
download | nextcloud-server-a4c0eb17569457784faa06ed0b65a319f7ec2f78.tar.gz nextcloud-server-a4c0eb17569457784faa06ed0b65a319f7ec2f78.zip |
improved tests
Diffstat (limited to 'apps/files_encryption/tests/keymanager.php')
-rw-r--r-- | apps/files_encryption/tests/keymanager.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/apps/files_encryption/tests/keymanager.php b/apps/files_encryption/tests/keymanager.php index 28452d779ca..3f6b936373c 100644 --- a/apps/files_encryption/tests/keymanager.php +++ b/apps/files_encryption/tests/keymanager.php @@ -57,6 +57,12 @@ class Test_Keymanager extends \PHPUnit_Framework_TestCase { \OC_FileProxy::register(new OCA\Encryption\Proxy()); + // remember files_trashbin state + $this->stateFilesTrashbin = OC_App::isEnabled('files_trashbin'); + + // we don't want to tests with app files_trashbin enabled + \OC_App::disable('files_trashbin'); + \OC_Util::tearDownFS(); \OC_User::setUserId(''); \OC\Files\Filesystem::tearDown(); @@ -72,6 +78,13 @@ class Test_Keymanager extends \PHPUnit_Framework_TestCase { \OC_FileProxy::$enabled = true; \OC_FileProxy::clearProxies(); + + // reset app files_trashbin + if ($this->stateFilesTrashbin) { + OC_App::enable('files_trashbin'); + } else { + OC_App::disable('files_trashbin'); + } } function testGetPrivateKey() { @@ -116,6 +129,16 @@ class Test_Keymanager extends \PHPUnit_Framework_TestCase { //$view = new \OC_FilesystemView( '/' . $this->userId . '/files_encryption/keyfiles' ); Encryption\Keymanager::setFileKey( $this->view, $file, $this->userId, $key['key'] ); + + // Disable encryption proxy to prevent recursive calls + $proxyStatus = \OC_FileProxy::$enabled; + \OC_FileProxy::$enabled = true; + + // cleanup + $this->view->unlink('/'.$this->userId . '/files/' . $file); + + // Re-enable proxy - our work is done + \OC_FileProxy::$enabled = $proxyStatus; } |