\OC_User::deleteUser(\Test_Encryption_Crypt::TEST_ENCRYPTION_CRYPT_USER1);
}
+ /**
+ * @medium
+ */
function testGenerateKey() {
# TODO: use more accurate (larger) string length for test confirmation
}
/**
+ * @large
* @return String
*/
function testGenerateIv() {
}
/**
+ * @large
* @depends testGenerateIv
*/
function testConcatIv($iv) {
}
/**
+ * @medium
* @depends testConcatIv
*/
function testSplitIv($testConcatIv) {
}
/**
+ * @medium
* @return string padded
*/
function testAddPadding() {
}
/**
+ * @medium
* @depends testAddPadding
*/
function testRemovePadding($padded) {
}
+ /**
+ * @medium
+ */
function testEncrypt() {
$random = openssl_random_pseudo_bytes(13);
}
+ /**
+ * @medium
+ */
function testDecrypt() {
$random = openssl_random_pseudo_bytes(13);
}
+ /**
+ * @medium
+ */
function testSymmetricEncryptFileContent() {
# TODO: search in keyfile for actual content as IV will ensure this test always passes
}
+ /**
+ * @medium
+ */
function testSymmetricStreamEncryptShortFileContent() {
$filename = 'tmp-' . time() . '.test';
}
/**
+ * @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
}
/**
+ * @medium
* @brief Test that data that is read by the crypto stream wrapper
*/
function testSymmetricStreamDecryptShortFileContent() {
$this->view->unlink($this->userId . '/files/' . $filename);
}
+ /**
+ * @medium
+ */
function testSymmetricStreamDecryptLongFileContent() {
$filename = 'tmp-' . time();
$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
}
+ /**
+ * @medium
+ */
function testIsEncryptedContent() {
$this->assertFalse(Encryption\Crypt::isCatfileContent($this->dataUrl));
}
+ /**
+ * @large
+ */
function testMultiKeyEncrypt() {
# TODO: search in keyfile for actual content as IV will ensure this test always passes
}
+ /**
+ * @medium
+ */
function testKeyEncrypt() {
// Generate keypair
}
/**
+ * @medium
* @brief test encryption using legacy blowfish method
*/
function testLegacyEncryptShort() {
}
/**
+ * @medium
* @brief test decryption using legacy blowfish method
* @depends testLegacyEncryptShort
*/
}
/**
+ * @medium
* @brief test encryption using legacy blowfish method
*/
function testLegacyEncryptLong() {
}
/**
+ * @medium
* @brief test decryption using legacy blowfish method
* @depends testLegacyEncryptLong
*/
}
/**
+ * @medium
* @brief test generation of legacy encryption key
* @depends testLegacyDecryptShort
*/
}
/**
+ * @medium
* @brief test decryption using legacy blowfish method
* @depends testLegacyEncryptLong
*/
}
+ /**
+ * @medium
+ */
function testRenameFile() {
$filename = 'tmp-' . time();
$view->unlink($newFilename);
}
+ /**
+ * @medium
+ */
function testMoveFileIntoFolder() {
$filename = 'tmp-' . time();
$view->unlink($newFolder);
}
+ /**
+ * @medium
+ */
function testMoveFolder() {
$view = new \OC\Files\View('/' . $this->userId . '/files');
$view->unlink('/newfolder');
}
+ /**
+ * @medium
+ */
function testChangePassphrase() {
$filename = 'tmp-' . time();
$view->unlink($filename);
}
+ /**
+ * @medium
+ */
function testViewFilePutAndGetContents() {
$filename = '/tmp-' . time();
$view->unlink($filename);
}
+ /**
+ * @large
+ */
function testTouchExistingFile() {
$filename = '/tmp-' . time();
$view = new \OC\Files\View('/' . $this->userId . '/files');
$view->unlink($filename);
}
+ /**
+ * @medium
+ */
function testTouchFile() {
$filename = '/tmp-' . time();
$view = new \OC\Files\View('/' . $this->userId . '/files');
$view->unlink($filename);
}
+ /**
+ * @medium
+ */
function testFopenFile() {
$filename = '/tmp-' . time();
$view = new \OC\Files\View('/' . $this->userId . '/files');
\OC_FileProxy::$enabled = true;
}
+ /**
+ * @medium
+ */
function testGetPrivateKey() {
$key = Encryption\Keymanager::getPrivateKey($this->view, $this->userId);
}
+ /**
+ * @medium
+ */
function testGetPublicKey() {
$publiceKey = Encryption\Keymanager::getPublicKey($this->view, $this->userId);
$this->assertArrayHasKey('key', $sslInfo);
}
+ /**
+ * @medium
+ */
function testSetFileKey() {
# NOTE: This cannot be tested until we are able to break out
}
+ /**
+ * @medium
+ */
function testGetUserKeys() {
$keys = Encryption\Keymanager::getUserKeys($this->view, $this->userId);
$this->assertArrayHasKey('key', $sslInfoPrivate);
}
+ /**
+ * @medium
+ */
function testFixPartialFilePath() {
$partFilename = 'testfile.txt.part';
$this->assertEquals('testfile.txt', Encryption\Keymanager::fixPartialFilePath($filename));
}
+ /**
+ * @medium
+ */
function testRecursiveDelShareKeys() {
// generate filename
}
/**
+ * @medium
* @param bool $withTeardown
*/
function testShareFile($withTeardown = true) {
}
/**
+ * @medium
* @param bool $withTeardown
*/
function testReShareFile($withTeardown = true) {
}
/**
+ * @medium
* @param bool $withTeardown
* @return array
*/
}
/**
+ * @medium
* @param bool $withTeardown
*/
function testReShareFolder($withTeardown = true) {
. $this->filename . '.' . \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1 . '.shareKey'));
}
+ /**
+ * @medium
+ */
function testShareFileWithGroup() {
// login as admin
\Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1);
}
+ /**
+ * @large
+ */
function testRecoveryFile() {
// login as admin
\Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1);
$this->assertEquals(0, \OC_Appconfig::getValue('files_encryption', 'recoveryAdminEnabled'));
}
+ /**
+ * @large
+ */
function testRecoveryForUser() {
// login as admin
\Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1);
$this->assertEquals(0, \OC_Appconfig::getValue('files_encryption', 'recoveryAdminEnabled'));
}
+ /**
+ * @medium
+ */
function testFailShareFile() {
// login as admin
\Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1);
}
/**
+ * @medium
* @brief test restore file
*
* @depends testDeleteFile
}
/**
+ * @medium
* @brief test delete file forever
*/
function testPermanentDeleteFile() {
}
/**
+ * @medium
* @brief test that paths set during User construction are correct
*/
function testKeyPaths() {
}
/**
+ * @medium
* @brief test setup of encryption directories
*/
function testSetupServerSide() {
}
/**
+ * @medium
* @brief test checking whether account is ready for encryption,
*/
function testUserIsReady() {
// }
/**
+ * @medium
* @brief test checking whether account is not ready for encryption,
*/
function testIsLegacyUser() {
$this->assertEquals($this->legacyKey, \OC::$session->get('legacyKey'));
}
+ /**
+ * @medium
+ */
function testRecoveryEnabledForUser() {
$util = new Encryption\Util($this->view, $this->userId);
}
+ /**
+ * @medium
+ */
function testGetUidAndFilename() {
\OC_User::setUserId(\Test_Encryption_Util::TEST_ENCRYPTION_UTIL_USER1);
$this->view->unlink($this->userId . '/files/' . $filename);
}
+ /**
+ * @medium
+ */
function testIsSharedPath() {
$sharedPath = '/user1/files/Shared/test';
$path = '/user1/files/test';
$this->assertFalse($this->util->isSharedPath($path));
}
+ /**
+ * @large
+ */
function testEncryptLegacyFiles() {
\Test_Encryption_Util::loginHelper(\Test_Encryption_Util::TEST_ENCRYPTION_UTIL_LEGACY_USER);
}
// everything in one test, they depend on each other
+ /**
+ * @medium
+ */
public function testSchema() {
$this->doTestSchemaCreating();
$this->doTestSchemaChanging();
$this->assertFalse($cache->inCache('folder/bar2.txt'));
}
+ /**
+ * @medium
+ */
public function testFileToFolder() {
$storage = $this->getTestStorage();
$cache = $storage->getCache();
}
}
+ /**
+ * @medium
+ */
public function testCacheAPI() {
$storage1 = $this->getTestStorage();
$storage2 = $this->getTestStorage();
$this->assertEquals(array(), $rootView->getDirectoryContent('/non/existing'));
}
+ /**
+ * @medium
+ */
function testGetPath() {
$storage1 = $this->getTestStorage();
$storage2 = $this->getTestStorage();
$this->assertNull($folderView->getPath($id1));
}
+ /**
+ * @medium
+ */
function testMountPointOverwrite() {
$storage1 = $this->getTestStorage(false);
$storage2 = $this->getTestStorage();
$this->assertEquals($textSize, $folderData[0]['size']);
}
+ /**
+ * @medium
+ */
function testSearch() {
$storage1 = $this->getTestStorage();
$storage2 = $this->getTestStorage();
$this->assertEquals(3, count($folderView->searchByMime('text')));
}
+ /**
+ * @medium
+ */
function testWatcher() {
$storage1 = $this->getTestStorage();
\OC\Files\Filesystem::mount($storage1, array(), '/');
$this->assertEquals(3, $cachedData['size']);
}
+ /**
+ * @medium
+ */
function testCopyBetweenStorages() {
$storage1 = $this->getTestStorage();
$storage2 = $this->getTestStorage();
$this->assertTrue($rootView->file_exists('/substorage/folder/bar.txt'));
}
+ /**
+ * @medium
+ */
function testMoveBetweenStorages() {
$storage1 = $this->getTestStorage();
$storage2 = $this->getTestStorage();
$this->assertTrue($rootView->file_exists('anotherfolder/bar.txt'));
}
+ /**
+ * @medium
+ */
function testTouch() {
$storage = $this->getTestStorage(true, '\Test\Files\TemporaryNoTouch');
<?xml version="1.0" encoding="utf-8" ?>
-<phpunit bootstrap="bootstrap.php">
+<phpunit bootstrap="bootstrap.php"
+ strict="true"
+ timeoutForSmallTests="3"
+ timeoutForMediumTests="30"
+ timeoutForLargeTests="90"
+>
<testsuite name='ownCloud'>
<directory suffix='.php'>lib/</directory>
<file>apps.php</file>