fixing some unit tests

This commit is contained in:
Bjoern Schiessle 2013-07-30 18:21:23 +02:00
parent 2549322763
commit 6c96a5273b
2 changed files with 6 additions and 6 deletions

View File

@ -141,9 +141,6 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase {
*/ */
function testSetFileKey() { function testSetFileKey() {
# 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'); $key = Encryption\Crypt::symmetricEncryptFileContentKeyfile($this->randomKey, 'hat');
$file = 'unittest-' . time() . '.txt'; $file = 'unittest-' . time() . '.txt';
@ -160,6 +157,9 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase {
//$view = new \OC_FilesystemView( '/' . $this->userId . '/files_encryption/keyfiles' ); //$view = new \OC_FilesystemView( '/' . $this->userId . '/files_encryption/keyfiles' );
Encryption\Keymanager::setFileKey($this->view, $file, $this->userId, $key['key']); Encryption\Keymanager::setFileKey($this->view, $file, $this->userId, $key['key']);
$this->assertTrue($this->view->file_exists(
'/' . $this->userId . '/files_encryption/keyfiles/' . $file . '.key'));
// enable encryption proxy // enable encryption proxy
$proxyStatus = \OC_FileProxy::$enabled; $proxyStatus = \OC_FileProxy::$enabled;
\OC_FileProxy::$enabled = true; \OC_FileProxy::$enabled = true;
@ -233,7 +233,7 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase {
\OC_FileProxy::$enabled = true; \OC_FileProxy::$enabled = true;
// save file with content // save file with content
$cryptedFile = file_put_contents('crypt://'.'/'.Test_Encryption_Keymanager::TEST_USER.'files//folder1/subfolder/subsubfolder/' . $filename, $this->dataShort); $cryptedFile = file_put_contents('crypt:///'.Test_Encryption_Keymanager::TEST_USER.'/files/folder1/subfolder/subsubfolder' . $filename, $this->dataShort);
// test that data was successfully written // test that data was successfully written
$this->assertTrue(is_int($cryptedFile)); $this->assertTrue(is_int($cryptedFile));

View File

@ -122,7 +122,7 @@ class Test_Encryption_Trashbin extends \PHPUnit_Framework_TestCase {
$filename = 'tmp-' . time() . '.txt'; $filename = 'tmp-' . time() . '.txt';
// save file with content // save file with content
$cryptedFile = file_put_contents('crypt:///' .$this->userId. '/files/'. $filename, $this->dataShort); $cryptedFile = file_put_contents('crypt:///' .\Test_Encryption_Trashbin::TEST_ENCRYPTION_TRASHBIN_USER1. '/files/'. $filename, $this->dataShort);
// test that data was successfully written // test that data was successfully written
$this->assertTrue(is_int($cryptedFile)); $this->assertTrue(is_int($cryptedFile));
@ -223,7 +223,7 @@ class Test_Encryption_Trashbin extends \PHPUnit_Framework_TestCase {
function testPermanentDeleteFile() { function testPermanentDeleteFile() {
// generate filename // generate filename
$filename = '/tmp-' . time() . '.txt'; $filename = 'tmp-' . time() . '.txt';
// save file with content // save file with content
$cryptedFile = file_put_contents('crypt:///' .$this->userId. '/files/' . $filename, $this->dataShort); $cryptedFile = file_put_contents('crypt:///' .$this->userId. '/files/' . $filename, $this->dataShort);