improved tests
This commit is contained in:
parent
1c8e5d6873
commit
f2b1158add
2 changed files with 13 additions and 41 deletions
|
@ -225,15 +225,20 @@ class Hooks {
|
|||
break;
|
||||
}
|
||||
|
||||
$error = false;
|
||||
foreach ($users as $user) {
|
||||
if (!$view->file_exists($user . '.public.key')) {
|
||||
// Set flag var 'run' to notify emitting
|
||||
// script that hook execution failed
|
||||
$params['run']->run = false;
|
||||
// TODO: Make sure files_sharing provides user
|
||||
// feedback on failed share
|
||||
$error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if($error)
|
||||
// Set flag var 'run' to notify emitting
|
||||
// script that hook execution failed
|
||||
$params['run']->run = false;
|
||||
// TODO: Make sure files_sharing provides user
|
||||
// feedback on failed share
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -706,7 +706,8 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->assertEquals($this->dataLong, $decrypt);
|
||||
|
||||
$newFolder = '/newfolder' . time();
|
||||
$newFolder = '/newfolder/subfolder' . time();
|
||||
$view->mkdir('/newfolder');
|
||||
|
||||
$view->rename($folder, $newFolder);
|
||||
|
||||
|
@ -719,43 +720,9 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase
|
|||
$view->unlink($newFolder);
|
||||
}
|
||||
|
||||
function testRenameFolder()
|
||||
{
|
||||
|
||||
$filename = '/tmp-' . time();
|
||||
|
||||
$folder = '/folder';
|
||||
$newFolder = '/newfolder';
|
||||
$view = new \OC\Files\View('/' . $this->userId . '/files');
|
||||
$view->mkdir($folder);
|
||||
|
||||
// Save long data as encrypted file using stream wrapper
|
||||
$cryptedFile = file_put_contents('crypt://' . $folder . $filename, $this->dataLong);
|
||||
|
||||
// Test that data was successfully written
|
||||
$this->assertTrue(is_int($cryptedFile));
|
||||
|
||||
// Get file decrypted contents
|
||||
$decrypt = file_get_contents('crypt://' . $folder . $filename);
|
||||
|
||||
$this->assertEquals($this->dataLong, $decrypt);
|
||||
|
||||
// rename folder
|
||||
$view->rename($folder, $newFolder);
|
||||
|
||||
// Get file decrypted contents
|
||||
$newDecrypt = file_get_contents('crypt://' . $newFolder . $filename);
|
||||
|
||||
$this->assertEquals($this->dataLong, $newDecrypt);
|
||||
|
||||
// tear down
|
||||
$view->unlink($newFolder);
|
||||
}
|
||||
|
||||
function testChangePassphrase()
|
||||
{
|
||||
|
||||
$filename = 'tmp-' . time();
|
||||
$filename = 'tmp-' . time();
|
||||
|
||||
// Save long data as encrypted file using stream wrapper
|
||||
$cryptedFile = file_put_contents('crypt://' . $filename, $this->dataLong);
|
||||
|
|
Loading…
Reference in a new issue