fixed some tests
This commit is contained in:
parent
3c100af132
commit
04b0843bb4
|
@ -21,7 +21,6 @@ use OCA\Encryption;
|
||||||
|
|
||||||
// This has to go here because otherwise session errors arise, and the private
|
// This has to go here because otherwise session errors arise, and the private
|
||||||
// encryption key needs to be saved in the session
|
// encryption key needs to be saved in the session
|
||||||
\OC_User::login( 'admin', 'admin' );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @note It would be better to use Mockery here for mocking out the session
|
* @note It would be better to use Mockery here for mocking out the session
|
||||||
|
@ -37,7 +36,7 @@ class Test_Crypt extends \PHPUnit_Framework_TestCase {
|
||||||
// reset backend
|
// reset backend
|
||||||
\OC_User::useBackend('database');
|
\OC_User::useBackend('database');
|
||||||
|
|
||||||
// set content for encrypting / decrypting in tests
|
// set content for encrypting / decrypting in tests
|
||||||
$this->dataLong = file_get_contents( realpath( dirname(__FILE__).'/../lib/crypt.php' ) );
|
$this->dataLong = file_get_contents( realpath( dirname(__FILE__).'/../lib/crypt.php' ) );
|
||||||
$this->dataShort = 'hats';
|
$this->dataShort = 'hats';
|
||||||
$this->dataUrl = realpath( dirname(__FILE__).'/../lib/crypt.php' );
|
$this->dataUrl = realpath( dirname(__FILE__).'/../lib/crypt.php' );
|
||||||
|
@ -60,13 +59,17 @@ class Test_Crypt extends \PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
\OC\Files\Filesystem::init($this->userId, '/');
|
\OC\Files\Filesystem::init($this->userId, '/');
|
||||||
\OC\Files\Filesystem::mount( 'OC_Filestorage_Local', array('datadir' => $this->dataDir), '/' );
|
\OC\Files\Filesystem::mount( 'OC_Filestorage_Local', array('datadir' => $this->dataDir), '/' );
|
||||||
|
|
||||||
|
$params['uid'] = $this->userId;
|
||||||
|
$params['password'] = $this->pass;
|
||||||
|
OCA\Encryption\Hooks::login($params);
|
||||||
}
|
}
|
||||||
|
|
||||||
function tearDown() {
|
function tearDown() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function testGenerateKey() {
|
function testGenerateKey() {
|
||||||
|
|
||||||
# TODO: use more accurate (larger) string length for test confirmation
|
# TODO: use more accurate (larger) string length for test confirmation
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ use OCA\Encryption;
|
||||||
|
|
||||||
// This has to go here because otherwise session errors arise, and the private
|
// This has to go here because otherwise session errors arise, and the private
|
||||||
// encryption key needs to be saved in the session
|
// encryption key needs to be saved in the session
|
||||||
\OC_User::login( 'admin', 'admin' );
|
//\OC_User::login( 'admin', 'admin' );
|
||||||
|
|
||||||
class Test_Keymanager extends \PHPUnit_Framework_TestCase {
|
class Test_Keymanager extends \PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
|
@ -52,7 +52,10 @@ class Test_Keymanager extends \PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
\OC\Files\Filesystem::init( $this->userId, '/' );
|
\OC\Files\Filesystem::init( $this->userId, '/' );
|
||||||
\OC\Files\Filesystem::mount( 'OC_Filestorage_Local', array('datadir' => $this->dataDir), '/' );
|
\OC\Files\Filesystem::mount( 'OC_Filestorage_Local', array('datadir' => $this->dataDir), '/' );
|
||||||
|
|
||||||
|
$params['uid'] = $this->userId;
|
||||||
|
$params['password'] = $this->pass;
|
||||||
|
OCA\Encryption\Hooks::login($params);
|
||||||
}
|
}
|
||||||
|
|
||||||
function tearDown(){
|
function tearDown(){
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// <?php
|
<?php
|
||||||
// /**
|
// /**
|
||||||
// * Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
|
// * Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
|
||||||
// * This file is licensed under the Affero General Public License version 3 or
|
// * This file is licensed under the Affero General Public License version 3 or
|
||||||
|
|
|
@ -24,8 +24,6 @@ $loader->register();
|
||||||
use \Mockery as m;
|
use \Mockery as m;
|
||||||
use OCA\Encryption;
|
use OCA\Encryption;
|
||||||
|
|
||||||
\OC_User::login( 'admin', 'admin' );
|
|
||||||
|
|
||||||
class Test_Enc_Util extends \PHPUnit_Framework_TestCase {
|
class Test_Enc_Util extends \PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
function setUp() {
|
function setUp() {
|
||||||
|
@ -62,6 +60,10 @@ class Test_Enc_Util extends \PHPUnit_Framework_TestCase {
|
||||||
\OC\Files\Filesystem::init( $this->userId, '/' );
|
\OC\Files\Filesystem::init( $this->userId, '/' );
|
||||||
\OC\Files\Filesystem::mount( 'OC_Filestorage_Local', array('datadir' => $this->dataDir), '/' );
|
\OC\Files\Filesystem::mount( 'OC_Filestorage_Local', array('datadir' => $this->dataDir), '/' );
|
||||||
|
|
||||||
|
$params['uid'] = $this->userId;
|
||||||
|
$params['password'] = $this->pass;
|
||||||
|
OCA\Encryption\Hooks::login($params);
|
||||||
|
|
||||||
$mockView = m::mock('OC_FilesystemView');
|
$mockView = m::mock('OC_FilesystemView');
|
||||||
$this->util = new Encryption\Util( $mockView, $this->userId );
|
$this->util = new Encryption\Util( $mockView, $this->userId );
|
||||||
|
|
||||||
|
@ -75,6 +77,9 @@ class Test_Enc_Util extends \PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief test that paths set during User construction are correct
|
* @brief test that paths set during User construction are correct
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
function testKeyPaths() {
|
function testKeyPaths() {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue