Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-04-13 20:16:38 +0300
committerGitHub <noreply@github.com>2017-04-13 20:16:38 +0300
commitd36751ee38ee3c9994ac6f2e44313b29d893d2f7 (patch)
tree195ac1fcd6698ace48d5cfdc07e101213363afb2 /tests/Core
parentec034757fae5143621d672a02c30e62f998449f5 (diff)
parentac05d6dd6777f564ec18dbc2ca530daa4bfaa99d (diff)
Merge pull request #2424 from nextcloud/fix-login-controller-test-consolidate-login
Fix login controller test and consolidate login
Diffstat (limited to 'tests/Core')
-rw-r--r--tests/Core/Controller/LoginControllerTest.php26
1 files changed, 14 insertions, 12 deletions
diff --git a/tests/Core/Controller/LoginControllerTest.php b/tests/Core/Controller/LoginControllerTest.php
index c8e85a19946..9387e69c405 100644
--- a/tests/Core/Controller/LoginControllerTest.php
+++ b/tests/Core/Controller/LoginControllerTest.php
@@ -333,6 +333,7 @@ class LoginControllerTest extends TestCase {
$user->expects($this->any())
->method('getUID')
->will($this->returnValue('uid'));
+ $loginName = 'loginli';
$user->expects($this->any())
->method('getLastLogin')
->willReturn(123456);
@@ -360,11 +361,11 @@ class LoginControllerTest extends TestCase {
->method('checkPasswordNoLogging')
->will($this->returnValue($user));
$this->userSession->expects($this->once())
- ->method('login')
- ->with($user, $password);
+ ->method('completeLogin')
+ ->with($user, ['loginName' => $loginName, 'password' => $password]);
$this->userSession->expects($this->once())
->method('createSessionToken')
- ->with($this->request, $user->getUID(), $user, $password, false);
+ ->with($this->request, $user->getUID(), $loginName, $password, false);
$this->twoFactorManager->expects($this->once())
->method('isTwoFactorAuthenticated')
->with($user)
@@ -386,7 +387,7 @@ class LoginControllerTest extends TestCase {
);
$expected = new \OCP\AppFramework\Http\RedirectResponse($indexPageUrl);
- $this->assertEquals($expected, $this->loginController->tryLogin($user, $password, null, false, 'Europe/Berlin', '1'));
+ $this->assertEquals($expected, $this->loginController->tryLogin($loginName, $password, null, false, 'Europe/Berlin', '1'));
}
public function testLoginWithValidCredentialsAndRememberMe() {
@@ -395,6 +396,7 @@ class LoginControllerTest extends TestCase {
$user->expects($this->any())
->method('getUID')
->will($this->returnValue('uid'));
+ $loginName = 'loginli';
$password = 'secret';
$indexPageUrl = \OC_Util::getDefaultPageUrl();
@@ -419,11 +421,11 @@ class LoginControllerTest extends TestCase {
->method('checkPasswordNoLogging')
->will($this->returnValue($user));
$this->userSession->expects($this->once())
- ->method('login')
- ->with($user, $password);
+ ->method('completeLogin')
+ ->with($user, ['loginName' => $loginName, 'password' => $password]);
$this->userSession->expects($this->once())
->method('createSessionToken')
- ->with($this->request, $user->getUID(), $user, $password, true);
+ ->with($this->request, $user->getUID(), $loginName, $password, true);
$this->twoFactorManager->expects($this->once())
->method('isTwoFactorAuthenticated')
->with($user)
@@ -436,7 +438,7 @@ class LoginControllerTest extends TestCase {
->with($user);
$expected = new \OCP\AppFramework\Http\RedirectResponse($indexPageUrl);
- $this->assertEquals($expected, $this->loginController->tryLogin($user, $password, null, true));
+ $this->assertEquals($expected, $this->loginController->tryLogin($loginName, $password, null, true));
}
public function testLoginWithoutPassedCsrfCheckAndNotLoggedIn() {
@@ -603,8 +605,8 @@ class LoginControllerTest extends TestCase {
->method('checkPasswordNoLogging')
->will($this->returnValue($user));
$this->userSession->expects($this->once())
- ->method('login')
- ->with('john@doe.com', $password);
+ ->method('completeLogin')
+ ->with($user, ['loginName' => 'john@doe.com', 'password' => $password]);
$this->userSession->expects($this->once())
->method('createSessionToken')
->with($this->request, $user->getUID(), 'john@doe.com', $password, false);
@@ -670,8 +672,8 @@ class LoginControllerTest extends TestCase {
->method('checkPasswordNoLogging')
->will($this->returnValue($user));
$this->userSession->expects($this->once())
- ->method('login')
- ->with('john@doe.com', $password);
+ ->method('completeLogin')
+ ->with($user, ['loginName' => 'john@doe.com', 'password' => $password]);
$this->userSession->expects($this->once())
->method('createSessionToken')
->with($this->request, $user->getUID(), 'john@doe.com', $password, false);