diff options
Diffstat (limited to 'apps/files_encryption/tests/crypt.php')
-rwxr-xr-x | apps/files_encryption/tests/crypt.php | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/apps/files_encryption/tests/crypt.php b/apps/files_encryption/tests/crypt.php index d856e5d59b5..e6ea3bcd6b3 100755 --- a/apps/files_encryption/tests/crypt.php +++ b/apps/files_encryption/tests/crypt.php @@ -102,6 +102,9 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { \OC_User::deleteUser(\Test_Encryption_Crypt::TEST_ENCRYPTION_CRYPT_USER1); } + /** + * @medium + */ function testGenerateKey() { # TODO: use more accurate (larger) string length for test confirmation @@ -113,6 +116,7 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { } /** + * @large * @return String */ function testGenerateIv() { @@ -126,6 +130,7 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { } /** + * @large * @depends testGenerateIv */ function testConcatIv($iv) { @@ -158,6 +163,7 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { } /** + * @medium * @depends testConcatIv */ function testSplitIv($testConcatIv) { @@ -174,6 +180,7 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { } /** + * @medium * @return string padded */ function testAddPadding() { @@ -189,6 +196,7 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { } /** + * @medium * @depends testAddPadding */ function testRemovePadding($padded) { @@ -199,6 +207,9 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { } + /** + * @medium + */ function testEncrypt() { $random = openssl_random_pseudo_bytes(13); @@ -211,6 +222,9 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { } + /** + * @medium + */ function testDecrypt() { $random = openssl_random_pseudo_bytes(13); @@ -241,6 +255,10 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { } + + /** + * @medium + */ function testSymmetricEncryptFileContent() { # TODO: search in keyfile for actual content as IV will ensure this test always passes @@ -256,6 +274,9 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { } + /** + * @medium + */ function testSymmetricStreamEncryptShortFileContent() { $filename = 'tmp-' . time() . '.test'; @@ -306,6 +327,7 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { } /** + * @medium * @brief Test that data that is written by the crypto stream wrapper * @note Encrypted data is manually prepared and decrypted here to avoid dependency on success of stream_read * @note If this test fails with truncate content, check that enough array slices are being rejoined to form $e, as the crypt.php file may have gotten longer and broken the manual @@ -392,6 +414,7 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { } /** + * @medium * @brief Test that data that is read by the crypto stream wrapper */ function testSymmetricStreamDecryptShortFileContent() { @@ -421,6 +444,9 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { $this->view->unlink($this->userId . '/files/' . $filename); } + /** + * @medium + */ function testSymmetricStreamDecryptLongFileContent() { $filename = 'tmp-' . time(); @@ -440,6 +466,9 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { $this->view->unlink($this->userId . '/files/' . $filename); } + /** + * @medium + */ function testSymmetricEncryptFileContentKeyfile() { # TODO: search in keyfile for actual content as IV will ensure this test always passes @@ -455,6 +484,9 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { } + /** + * @medium + */ function testIsEncryptedContent() { $this->assertFalse(Encryption\Crypt::isCatfileContent($this->dataUrl)); @@ -467,6 +499,9 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { } + /** + * @large + */ function testMultiKeyEncrypt() { # TODO: search in keyfile for actual content as IV will ensure this test always passes @@ -491,6 +526,9 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { } + /** + * @medium + */ function testKeyEncrypt() { // Generate keypair @@ -509,6 +547,7 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { } /** + * @medium * @brief test encryption using legacy blowfish method */ function testLegacyEncryptShort() { @@ -525,6 +564,7 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { } /** + * @medium * @brief test decryption using legacy blowfish method * @depends testLegacyEncryptShort */ @@ -537,6 +577,7 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { } /** + * @medium * @brief test encryption using legacy blowfish method */ function testLegacyEncryptLong() { @@ -553,6 +594,7 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { } /** + * @medium * @brief test decryption using legacy blowfish method * @depends testLegacyEncryptLong */ @@ -566,6 +608,7 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { } /** + * @medium * @brief test generation of legacy encryption key * @depends testLegacyDecryptShort */ @@ -585,6 +628,7 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { } /** + * @medium * @brief test decryption using legacy blowfish method * @depends testLegacyEncryptLong */ @@ -601,6 +645,9 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { } + /** + * @medium + */ function testRenameFile() { $filename = 'tmp-' . time(); @@ -629,6 +676,9 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { $view->unlink($newFilename); } + /** + * @medium + */ function testMoveFileIntoFolder() { $filename = 'tmp-' . time(); @@ -659,6 +709,9 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { $view->unlink($newFolder); } + /** + * @medium + */ function testMoveFolder() { $view = new \OC\Files\View('/' . $this->userId . '/files'); @@ -694,6 +747,9 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { $view->unlink('/newfolder'); } + /** + * @medium + */ function testChangePassphrase() { $filename = 'tmp-' . time(); @@ -728,6 +784,9 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { $view->unlink($filename); } + /** + * @medium + */ function testViewFilePutAndGetContents() { $filename = '/tmp-' . time(); @@ -759,6 +818,9 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { $view->unlink($filename); } + /** + * @large + */ function testTouchExistingFile() { $filename = '/tmp-' . time(); $view = new \OC\Files\View('/' . $this->userId . '/files'); @@ -780,6 +842,9 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { $view->unlink($filename); } + /** + * @medium + */ function testTouchFile() { $filename = '/tmp-' . time(); $view = new \OC\Files\View('/' . $this->userId . '/files'); @@ -801,6 +866,9 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { $view->unlink($filename); } + /** + * @medium + */ function testFopenFile() { $filename = '/tmp-' . time(); $view = new \OC\Files\View('/' . $this->userId . '/files'); |