[Pkg-owncloud-commits] [owncloud] 08/16: create the user 'admin' before running the tests

David Prévot taffit at moszumanska.debian.org
Wed Mar 11 15:49:30 UTC 2015


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

taffit pushed a commit to annotated tag v5.0.19
in repository owncloud.

commit 10af54f20ee38cd42074308ad73c6223f811d3b3
Author: Bjoern Schiessle <schiessle at owncloud.com>
Date:   Tue Sep 23 10:29:12 2014 +0200

    create the user 'admin' before running the tests
---
 apps/files_encryption/tests/keymanager.php | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/apps/files_encryption/tests/keymanager.php b/apps/files_encryption/tests/keymanager.php
index 40ae165..4216f51 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;
 
@@ -47,17 +48,8 @@ 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 = (\OC_User::userExists('admin')) ? false : true;
+		\Test_Encryption_Util::loginHelper('admin', $create);
 	}
 
 	function setUp() {
@@ -101,6 +93,8 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase {
 
 	public static function tearDownAfterClass() {
 		\OC_FileProxy::$enabled = true;
+		// delete admin user again
+		\OC_User::deleteUser('admin');
 	}
 
 	function testGetPrivateKey() {
@@ -134,7 +128,7 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase {
 
 	function testSetFileKey() {
 
-		# NOTE: This cannot be tested until we are able to break out 
+		# NOTE: This cannot be tested until we are able to break out
 		# of the FileSystemView data directory root
 
 		$key = Encryption\Crypt::symmetricEncryptFileContentKeyfile($this->randomKey, 'hat');

-- 
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