summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-06-08 10:12:28 +0200
committerVincent Petry <pvince81@owncloud.com>2016-06-08 10:12:28 +0200
commitb7935dcebd97a0a3f08909548a38e8596f8eb4d9 (patch)
tree0ae11157775945dd57e29dcdff970961729a9da7 /tests
parent111b4d705108bfa215a4bc9440b2175fd2f8a40f (diff)
parentd4ba982131de93b0217c9376307489fe4ca033b0 (diff)
downloadnextcloud-server-b7935dcebd97a0a3f08909548a38e8596f8eb4d9.tar.gz
nextcloud-server-b7935dcebd97a0a3f08909548a38e8596f8eb4d9.zip
Merge pull request #24998 from owncloud/issue-24994-allow-decrypting-user-0-only
Allow to decrypt user '0' files only
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Encryption/DecryptAllTest.php35
1 files changed, 23 insertions, 12 deletions
diff --git a/tests/lib/Encryption/DecryptAllTest.php b/tests/lib/Encryption/DecryptAllTest.php
index ffcbbc74a99..d7cf2fb7baf 100644
--- a/tests/lib/Encryption/DecryptAllTest.php
+++ b/tests/lib/Encryption/DecryptAllTest.php
@@ -86,13 +86,25 @@ class DecryptAllTest extends TestCase {
$this->invokePrivate($this->instance, 'output', [$this->outputInterface]);
}
+ public function dataDecryptAll() {
+ return [
+ [true, 'user1', true],
+ [false, 'user1', true],
+ [true, '0', true],
+ [false, '0', true],
+ [true, '', false],
+ ];
+ }
+
/**
- * @dataProvider dataTrueFalse
+ * @dataProvider dataDecryptAll
* @param bool $prepareResult
+ * @param string $user
+ * @param bool $userExistsChecked
*/
- public function testDecryptAll($prepareResult, $user) {
+ public function testDecryptAll($prepareResult, $user, $userExistsChecked) {
- if (!empty($user)) {
+ if ($userExistsChecked) {
$this->userManager->expects($this->once())->method('userExists')->willReturn(true);
} else {
$this->userManager->expects($this->never())->method('userExists');
@@ -125,15 +137,6 @@ class DecryptAllTest extends TestCase {
$instance->decryptAll($this->inputInterface, $this->outputInterface, $user);
}
- public function dataTrueFalse() {
- return [
- [true, 'user1'],
- [false, 'user1'],
- [true, ''],
- [true, null]
- ];
- }
-
/**
* test decrypt all call with a user who doesn't exists
*/
@@ -147,8 +150,16 @@ class DecryptAllTest extends TestCase {
);
}
+ public function dataTrueFalse() {
+ return [
+ [true],
+ [false],
+ ];
+ }
+
/**
* @dataProvider dataTrueFalse
+ * @param bool $success
*/
public function testPrepareEncryptionModules($success) {