summaryrefslogtreecommitdiffstats
path: root/apps/encryption/tests/hooks/UserHooksTest.php
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-04-21 11:48:26 +0200
committerVincent Petry <pvince81@owncloud.com>2016-04-21 11:48:26 +0200
commitb50d3255fb512c1b4f1186a5874c9528d9b407a3 (patch)
tree8874e8f1d00f1b3694951ada7234622bb21fb291 /apps/encryption/tests/hooks/UserHooksTest.php
parent6f5d3adfa405d41dd0e803d44bd54efcaa35769b (diff)
parent89223379ad155ae0896d1481089e3751257aa76f (diff)
downloadnextcloud-server-b50d3255fb512c1b4f1186a5874c9528d9b407a3.tar.gz
nextcloud-server-b50d3255fb512c1b4f1186a5874c9528d9b407a3.zip
Merge pull request #22791 from owncloud/enc_master_key_improvements
Enc master key improvements
Diffstat (limited to 'apps/encryption/tests/hooks/UserHooksTest.php')
-rw-r--r--apps/encryption/tests/hooks/UserHooksTest.php33
1 files changed, 19 insertions, 14 deletions
diff --git a/apps/encryption/tests/hooks/UserHooksTest.php b/apps/encryption/tests/hooks/UserHooksTest.php
index d2a7d4f2d04..df3d12b3401 100644
--- a/apps/encryption/tests/hooks/UserHooksTest.php
+++ b/apps/encryption/tests/hooks/UserHooksTest.php
@@ -77,7 +77,7 @@ class UserHooksTest extends TestCase {
private $params = ['uid' => 'testUser', 'password' => 'password'];
public function testLogin() {
- $this->userSetupMock->expects($this->exactly(2))
+ $this->userSetupMock->expects($this->once())
->method('setupUser')
->willReturnOnConsecutiveCalls(true, false);
@@ -86,7 +86,6 @@ class UserHooksTest extends TestCase {
->with('testUser', 'password');
$this->assertNull($this->instance->login($this->params));
- $this->assertFalse($this->instance->login($this->params));
}
public function testLogout() {
@@ -279,11 +278,11 @@ class UserHooksTest extends TestCase {
public function testPostPasswordReset() {
$this->keyManagerMock->expects($this->once())
- ->method('replaceUserKeys')
+ ->method('deleteUserKeys')
->with('testUser');
$this->userSetupMock->expects($this->once())
- ->method('setupServerSide')
+ ->method('setupUser')
->with('testUser', 'password');
$this->assertNull($this->instance->postPasswordReset($this->params));
@@ -339,16 +338,22 @@ class UserHooksTest extends TestCase {
$this->sessionMock = $sessionMock;
$this->recoveryMock = $recoveryMock;
$this->utilMock = $utilMock;
- $this->instance = new UserHooks($this->keyManagerMock,
- $this->userManagerMock,
- $this->loggerMock,
- $this->userSetupMock,
- $this->userSessionMock,
- $this->utilMock,
- $this->sessionMock,
- $this->cryptMock,
- $this->recoveryMock
- );
+ $this->utilMock->expects($this->any())->method('isMasterKeyEnabled')->willReturn(false);
+
+ $this->instance = $this->getMockBuilder('OCA\Encryption\Hooks\UserHooks')
+ ->setConstructorArgs(
+ [
+ $this->keyManagerMock,
+ $this->userManagerMock,
+ $this->loggerMock,
+ $this->userSetupMock,
+ $this->userSessionMock,
+ $this->utilMock,
+ $this->sessionMock,
+ $this->cryptMock,
+ $this->recoveryMock
+ ]
+ )->setMethods(['setupFS'])->getMock();
}