diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2013-07-22 14:48:49 -0700 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2013-07-22 14:48:49 -0700 |
commit | 6ddad8dc4990e522630b020a8d06fdf939776f05 (patch) | |
tree | 764d27d95b055e007c185299ef2b6253ac5e16f4 /apps/files_encryption | |
parent | 7abf35b085fe9ba22c045c3b82431ddab32c5a90 (diff) | |
parent | 6e2418141d7ef6a9b09f5a414aba52d0d5241efe (diff) | |
download | nextcloud-server-6ddad8dc4990e522630b020a8d06fdf939776f05.tar.gz nextcloud-server-6ddad8dc4990e522630b020a8d06fdf939776f05.zip |
Merge pull request #4126 from owncloud/parallel-autotest.sh-master
Parallel autotest.sh master
Diffstat (limited to 'apps/files_encryption')
-rw-r--r-- | apps/files_encryption/tests/keymanager.php | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/apps/files_encryption/tests/keymanager.php b/apps/files_encryption/tests/keymanager.php index 19ba9a8117f..b644856d95d 100644 --- a/apps/files_encryption/tests/keymanager.php +++ b/apps/files_encryption/tests/keymanager.php @@ -14,6 +14,7 @@ require_once realpath(dirname(__FILE__) . '/../lib/stream.php'); require_once realpath(dirname(__FILE__) . '/../lib/util.php'); require_once realpath(dirname(__FILE__) . '/../lib/helper.php'); require_once realpath(dirname(__FILE__) . '/../appinfo/app.php'); +require_once realpath(dirname(__FILE__) . '/util.php'); use OCA\Encryption; @@ -22,6 +23,8 @@ use OCA\Encryption; */ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase { + const TEST_USER = "test-keymanager-user"; + public $userId; public $pass; public $stateFilesTrashbin; @@ -47,17 +50,9 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase { // disable file proxy by default \OC_FileProxy::$enabled = false; - // setup filesystem - \OC_Util::tearDownFS(); - \OC_User::setUserId(''); - \OC\Files\Filesystem::tearDown(); - \OC_Util::setupFS('admin'); - \OC_User::setUserId('admin'); - - // login admin - $params['uid'] = 'admin'; - $params['password'] = 'admin'; - OCA\Encryption\Hooks::login($params); + // create test user + \OC_User::deleteUser(\Test_Encryption_Keymanager::TEST_USER); + \Test_Encryption_Util::loginHelper(\Test_Encryption_Keymanager::TEST_USER, true); } function setUp() { @@ -75,9 +70,9 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase { $this->view = new \OC_FilesystemView('/'); - \OC_User::setUserId('admin'); - $this->userId = 'admin'; - $this->pass = 'admin'; + \OC_User::setUserId(\Test_Encryption_Keymanager::TEST_USER); + $this->userId = \Test_Encryption_Keymanager::TEST_USER; + $this->pass = \Test_Encryption_Keymanager::TEST_USER; $userHome = \OC_User::getHome($this->userId); $this->dataDir = str_replace('/' . $this->userId, '', $userHome); @@ -101,6 +96,9 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase { public static function tearDownAfterClass() { \OC_FileProxy::$enabled = true; + + // cleanup test user + \OC_User::deleteUser(\Test_Encryption_Keymanager::TEST_USER); } /** @@ -226,9 +224,9 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase { $filename = '/tmp-' . time() . '.txt'; // create folder structure - $this->view->mkdir('/admin/files/folder1'); - $this->view->mkdir('/admin/files/folder1/subfolder'); - $this->view->mkdir('/admin/files/folder1/subfolder/subsubfolder'); + $this->view->mkdir('/'.Test_Encryption_Keymanager::TEST_USER.'/files/folder1'); + $this->view->mkdir('/'.Test_Encryption_Keymanager::TEST_USER.'/files/folder1/subfolder'); + $this->view->mkdir('/'.Test_Encryption_Keymanager::TEST_USER.'/files/folder1/subfolder/subsubfolder'); // enable encryption proxy $proxyStatus = \OC_FileProxy::$enabled; |