diff options
author | Sam Tuke <samtuke@owncloud.com> | 2013-01-23 19:24:26 +0000 |
---|---|---|
committer | Sam Tuke <samtuke@owncloud.com> | 2013-01-23 19:24:26 +0000 |
commit | 59ca312263d358c95b950266c678c71bf97716f3 (patch) | |
tree | de61cad1224cf80c4d370de78d85e701eff7f121 /apps/files_encryption/test | |
parent | cd832935e8b92a2461dedbd9eed92d2cd3337d92 (diff) | |
download | nextcloud-server-59ca312263d358c95b950266c678c71bf97716f3.tar.gz nextcloud-server-59ca312263d358c95b950266c678c71bf97716f3.zip |
Work on util: findFiles() and encryptAll(); both close to working
Ecnryption unit tests are failing, recursion in filecache{}
Diffstat (limited to 'apps/files_encryption/test')
-rwxr-xr-x | apps/files_encryption/test/crypt.php | 6 | ||||
-rwxr-xr-x | apps/files_encryption/test/util.php | 23 |
2 files changed, 22 insertions, 7 deletions
diff --git a/apps/files_encryption/test/crypt.php b/apps/files_encryption/test/crypt.php index 5a7820dc9da..755a6cc72fa 100755 --- a/apps/files_encryption/test/crypt.php +++ b/apps/files_encryption/test/crypt.php @@ -416,13 +416,13 @@ class Test_Crypt extends \PHPUnit_Framework_TestCase { function testIsEncryptedContent() { - $this->assertFalse( Encryption\Crypt::isEncryptedContent( $this->dataUrl ) ); + $this->assertFalse( Encryption\Crypt::isCatfile( $this->dataUrl ) ); - $this->assertFalse( Encryption\Crypt::isEncryptedContent( $this->legacyEncryptedData ) ); + $this->assertFalse( Encryption\Crypt::isCatfile( $this->legacyEncryptedData ) ); $keyfileContent = Encryption\Crypt::symmetricEncryptFileContent( $this->dataUrl, 'hat' ); - $this->assertTrue( Encryption\Crypt::isEncryptedContent( $keyfileContent ) ); + $this->assertTrue( Encryption\Crypt::isCatfile( $keyfileContent ) ); } diff --git a/apps/files_encryption/test/util.php b/apps/files_encryption/test/util.php index 016787fbfba..79f8ede543d 100755 --- a/apps/files_encryption/test/util.php +++ b/apps/files_encryption/test/util.php @@ -51,7 +51,7 @@ class Test_Enc_Util extends \PHPUnit_Framework_TestCase { $this->publicKeyPath = $this->publicKeyDir . '/' . $this->userId . '.public.key'; // e.g. data/public-keys/admin.public.key $this->privateKeyPath = $this->encryptionDir . '/' . $this->userId . '.private.key'; // e.g. data/admin/admin.private.key - $this->view = new OC_FilesystemView( '/admin' ); + $this->view = new \OC_FilesystemView( '/' ); $this->mockView = m::mock('OC_FilesystemView'); $this->util = new Encryption\Util( $this->mockView, $this->userId ); @@ -88,8 +88,8 @@ class Test_Enc_Util extends \PHPUnit_Framework_TestCase { $mockView = m::mock('OC_FilesystemView'); - $mockView->shouldReceive( 'file_exists' )->times(4)->andReturn( false ); - $mockView->shouldReceive( 'mkdir' )->times(3)->andReturn( true ); + $mockView->shouldReceive( 'file_exists' )->times(5)->andReturn( false ); + $mockView->shouldReceive( 'mkdir' )->times(4)->andReturn( true ); $mockView->shouldReceive( 'file_put_contents' )->withAnyArgs(); $util = new Encryption\Util( $mockView, $this->userId ); @@ -105,7 +105,7 @@ class Test_Enc_Util extends \PHPUnit_Framework_TestCase { $mockView = m::mock('OC_FilesystemView'); - $mockView->shouldReceive( 'file_exists' )->times(5)->andReturn( true ); + $mockView->shouldReceive( 'file_exists' )->times(6)->andReturn( true ); $mockView->shouldReceive( 'file_put_contents' )->withAnyArgs(); $util = new Encryption\Util( $mockView, $this->userId ); @@ -149,6 +149,21 @@ class Test_Enc_Util extends \PHPUnit_Framework_TestCase { # then false will be returned. Use strict ordering? } + + function testFindFiles() { + +// $this->view->chroot( "/data/{$this->userId}/files" ); + + $util = new Encryption\Util( $this->view, $this->userId ); + + $files = $util->findFiles( '/', 'encrypted' ); + + var_dump( $files ); + + # TODO: Add more tests here to check that if any of the dirs are + # then false will be returned. Use strict ordering? + + } // /** // * @brief test decryption using legacy blowfish method |