diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2015-04-24 13:02:06 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2015-04-27 13:01:18 +0200 |
commit | 27683f944289e7b37f20ec7d877ed295d5ca66a3 (patch) | |
tree | 83c7f72931cbdc6549816030bf8333a0ca9eef2d /apps/encryption/tests | |
parent | e58029f8ad9ed4ddb1a68ea91e76e6a8d749fe27 (diff) | |
download | nextcloud-server-27683f944289e7b37f20ec7d877ed295d5ca66a3.tar.gz nextcloud-server-27683f944289e7b37f20ec7d877ed295d5ca66a3.zip |
fall back to the ownCloud default encryption module and aes128 if we read a encrypted file without a header
Diffstat (limited to 'apps/encryption/tests')
-rw-r--r-- | apps/encryption/tests/lib/crypto/encryptionTest.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/apps/encryption/tests/lib/crypto/encryptionTest.php b/apps/encryption/tests/lib/crypto/encryptionTest.php index 9e14a70ebb0..500433c77d4 100644 --- a/apps/encryption/tests/lib/crypto/encryptionTest.php +++ b/apps/encryption/tests/lib/crypto/encryptionTest.php @@ -72,5 +72,32 @@ class EncryptionTest extends TestCase { ); } + /** + * @dataProvider dataTestBegin + */ + public function testBegin($mode, $header, $legacyCipher, $defaultCipher, $expected) { + + $this->cryptMock->expects($this->any()) + ->method('getCipher') + ->willReturn($defaultCipher); + $this->cryptMock->expects($this->any()) + ->method('getLegacyCipher') + ->willReturn($legacyCipher); + + $result = $this->instance->begin('/user/files/foo.txt', 'user', $mode, $header, []); + + $this->assertArrayHasKey('cipher', $result); + $this->assertSame($expected, $result['cipher']); + } + + public function dataTestBegin() { + return array( + array('w', ['cipher' => 'myCipher'], 'legacyCipher', 'defaultCipher', 'myCipher'), + array('r', ['cipher' => 'myCipher'], 'legacyCipher', 'defaultCipher', 'myCipher'), + array('w', [], 'legacyCipher', 'defaultCipher', 'defaultCipher'), + array('r', [], 'legacyCipher', 'defaultCipher', 'legacyCipher'), + ); + } + }
\ No newline at end of file |