summaryrefslogtreecommitdiffstats
path: root/apps/encryption/tests
diff options
context:
space:
mode:
authorBjoern Schiessle <bjoern@schiessle.org>2018-08-16 15:06:23 +0200
committerBjoern Schiessle <bjoern@schiessle.org>2018-08-16 15:51:01 +0200
commit3adc2aca53bdfaa250ba7b5f3c26ea81c0db4d81 (patch)
tree5522d1f04d8a69041eded367a6904ebb0f119352 /apps/encryption/tests
parentf7ae4771c8b056c72dc0a68e0d62be7d2407c0d2 (diff)
downloadnextcloud-server-3adc2aca53bdfaa250ba7b5f3c26ea81c0db4d81.tar.gz
nextcloud-server-3adc2aca53bdfaa250ba7b5f3c26ea81c0db4d81.zip
add occ command to recover encrypted files in case of password lost
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'apps/encryption/tests')
-rw-r--r--apps/encryption/tests/Hooks/UserHooksTest.php17
1 files changed, 8 insertions, 9 deletions
diff --git a/apps/encryption/tests/Hooks/UserHooksTest.php b/apps/encryption/tests/Hooks/UserHooksTest.php
index 91005e2746a..b14a1f6a559 100644
--- a/apps/encryption/tests/Hooks/UserHooksTest.php
+++ b/apps/encryption/tests/Hooks/UserHooksTest.php
@@ -210,9 +210,9 @@ class UserHooksTest extends TestCase {
}
public function testSetPassphrase() {
- $this->sessionMock->expects($this->exactly(4))
+ $this->sessionMock->expects($this->once())
->method('getPrivateKey')
- ->willReturnOnConsecutiveCalls(true, false);
+ ->willReturn(true);
$this->cryptMock->expects($this->exactly(4))
->method('encryptPrivateKey')
@@ -236,7 +236,7 @@ class UserHooksTest extends TestCase {
$this->recoveryMock->expects($this->exactly(3))
->method('isRecoveryEnabledForUser')
- ->with('testUser')
+ ->with('testUser1')
->willReturnOnConsecutiveCalls(true, false);
@@ -257,13 +257,15 @@ class UserHooksTest extends TestCase {
$this->instance->expects($this->exactly(3))->method('initMountPoints');
+ $this->params['uid'] = 'testUser1';
+
// Test first if statement
$this->assertNull($this->instance->setPassphrase($this->params));
// Test Second if conditional
$this->keyManagerMock->expects($this->exactly(2))
->method('userHasKeys')
- ->with('testUser')
+ ->with('testUser1')
->willReturn(true);
$this->assertNull($this->instance->setPassphrase($this->params));
@@ -271,7 +273,7 @@ class UserHooksTest extends TestCase {
// Test third and final if condition
$this->utilMock->expects($this->once())
->method('userHasFiles')
- ->with('testUser')
+ ->with('testUser1')
->willReturn(false);
$this->cryptMock->expects($this->once())
@@ -282,7 +284,7 @@ class UserHooksTest extends TestCase {
$this->recoveryMock->expects($this->once())
->method('recoverUsersFiles')
- ->with('password', 'testUser');
+ ->with('password', 'testUser1');
$this->assertNull($this->instance->setPassphrase($this->params));
}
@@ -297,9 +299,6 @@ class UserHooksTest extends TestCase {
}
public function testSetPasswordNoUser() {
- $this->sessionMock->expects($this->once())
- ->method('getPrivateKey')
- ->willReturn(true);
$userSessionMock = $this->getMockBuilder(IUserSession::class)
->disableOriginalConstructor()