Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorin Peter <github@florin-peter.de>2013-05-20 00:28:48 +0400
committerFlorin Peter <github@florin-peter.de>2013-05-20 00:28:48 +0400
commitbdd2127f19db92d7f3eccfa0cee402add23529f6 (patch)
tree5c7888ecec34fcbb8dc94dc807c277cd4d317868 /apps/files_encryption/tests/crypt.php
parentddda2a1f795122518d13b8654ab4a738d6fa526f (diff)
cleanup tests
Diffstat (limited to 'apps/files_encryption/tests/crypt.php')
-rwxr-xr-xapps/files_encryption/tests/crypt.php64
1 files changed, 30 insertions, 34 deletions
diff --git a/apps/files_encryption/tests/crypt.php b/apps/files_encryption/tests/crypt.php
index 18faaceb031..c669aec1222 100755
--- a/apps/files_encryption/tests/crypt.php
+++ b/apps/files_encryption/tests/crypt.php
@@ -19,8 +19,25 @@ require_once realpath( dirname(__FILE__).'/../appinfo/app.php' );
use OCA\Encryption;
+/**
+ * Class Test_Encryption_Crypt
+ */
class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase {
-
+
+ public $userId;
+ public $pass;
+ public $stateFilesTrashbin;
+ public $dataLong;
+ public $dataUrl;
+ public $dataShort;
+ /**
+ * @var OC_FilesystemView
+ */
+ public $view;
+ public $legacyEncryptedData;
+ public $genPrivateKey;
+ public $genPublicKey;
+
function setUp() {
// reset backend
\OC_User::clearBackends();
@@ -93,7 +110,10 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase {
$this->assertTrue( strlen( $key ) > 16 );
}
-
+
+ /**
+ * @return String
+ */
function testGenerateIv() {
$iv = Encryption\Crypt::generateIv();
@@ -150,7 +170,10 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase {
$this->assertEquals( $this->dataLong, $splitCatfile['encrypted'] );
}
-
+
+ /**
+ * @return string padded
+ */
function testAddPadding() {
$padded = Encryption\Crypt::addPadding( $this->dataLong );
@@ -214,34 +237,7 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase {
$this->assertEquals( $this->dataShort, $decrypt );
}
-
- // These aren't used for now
-// function testSymmetricBlockEncryptShortFileContent() {
-//
-// $crypted = Encryption\Crypt::symmetricBlockEncryptFileContent( $this->dataShort, $this->randomKey );
-//
-// $this->assertNotEquals( $this->dataShort, $crypted );
-//
-//
-// $decrypt = Encryption\Crypt::symmetricBlockDecryptFileContent( $crypted, $this->randomKey );
-//
-// $this->assertEquals( $this->dataShort, $decrypt );
-//
-// }
-//
-// function testSymmetricBlockEncryptLongFileContent() {
-//
-// $crypted = Encryption\Crypt::symmetricBlockEncryptFileContent( $this->dataLong, $this->randomKey );
-//
-// $this->assertNotEquals( $this->dataLong, $crypted );
-//
-//
-// $decrypt = Encryption\Crypt::symmetricBlockDecryptFileContent( $crypted, $this->randomKey );
-//
-// $this->assertEquals( $this->dataLong, $decrypt );
-//
-// }
-
+
function testSymmetricStreamEncryptShortFileContent() {
$filename = 'tmp-'.time().'.test';
@@ -351,9 +347,9 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase {
$decrypt = '';
// Manually decrypt chunk
- foreach ($e as $e) {
+ foreach ($e as $chunk) {
- $chunkDecrypt = Encryption\Crypt::symmetricDecryptFileContent( $e, $plainKeyfile );
+ $chunkDecrypt = Encryption\Crypt::symmetricDecryptFileContent( $chunk, $plainKeyfile );
// Assemble decrypted chunks
$decrypt .= $chunkDecrypt;
@@ -741,7 +737,7 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase {
$this->assertEquals( $this->dataLong, $decrypt );
// change password
- \OC_User::setPassword($this->userId, 'test');
+ \OC_User::setPassword($this->userId, 'test', null);
// relogin
$params['uid'] = $this->userId;