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
path: root/tests
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-01-13 23:18:05 +0300
committerRoeland Jago Douma <roeland@famdouma.nl>2018-01-15 23:43:11 +0300
commitb1d808470058f655fde6f29d04b542574a7a3e38 (patch)
tree53455d792298ab9040e0a4f46a3f7758e85a86ed /tests
parent7cab7feb38b0456ac923869e7dad5976d2ab874a (diff)
Fix tests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'tests')
-rw-r--r--tests/Core/Controller/LoginControllerTest.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/Core/Controller/LoginControllerTest.php b/tests/Core/Controller/LoginControllerTest.php
index ddf7a865d66..c0de180abba 100644
--- a/tests/Core/Controller/LoginControllerTest.php
+++ b/tests/Core/Controller/LoginControllerTest.php
@@ -23,6 +23,7 @@ namespace Tests\Core\Controller;
use OC\Authentication\TwoFactorAuth\Manager;
use OC\Core\Controller\LoginController;
+use OC\Security\Bruteforce\Throttler;
use OC\User\Session;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\AppFramework\Http\TemplateResponse;
@@ -57,6 +58,8 @@ class LoginControllerTest extends TestCase {
private $twoFactorManager;
/** @var Defaults|\PHPUnit_Framework_MockObject_MockObject */
private $defaults;
+ /** @var Throttler|\PHPUnit_Framework_MockObject_MockObject */
+ private $throttler;
public function setUp() {
parent::setUp();
@@ -69,6 +72,15 @@ class LoginControllerTest extends TestCase {
$this->logger = $this->createMock(ILogger::class);
$this->twoFactorManager = $this->createMock(Manager::class);
$this->defaults = $this->createMock(Defaults::class);
+ $this->throttler = $this->createMock(Throttler::class);
+
+ $this->request->method('getRemoteAddress')
+ ->willReturn('1.2.3.4');
+ $this->throttler->method('getDelay')
+ ->with(
+ $this->equalTo('1.2.3.4'),
+ $this->equalTo('')
+ )->willReturn(1000);
$this->loginController = new LoginController(
'core',
@@ -80,7 +92,8 @@ class LoginControllerTest extends TestCase {
$this->urlGenerator,
$this->logger,
$this->twoFactorManager,
- $this->defaults
+ $this->defaults,
+ $this->throttler
);
}
@@ -183,6 +196,7 @@ class LoginControllerTest extends TestCase {
'rememberLoginState' => 0,
'resetPasswordLink' => null,
'hideRemeberLoginState' => false,
+ 'throttle_delay' => 1000,
],
'guest'
);
@@ -213,6 +227,7 @@ class LoginControllerTest extends TestCase {
'rememberLoginState' => 0,
'resetPasswordLink' => null,
'hideRemeberLoginState' => true,
+ 'throttle_delay' => 1000,
],
'guest'
);
@@ -272,6 +287,7 @@ class LoginControllerTest extends TestCase {
'rememberLoginState' => 0,
'resetPasswordLink' => false,
'hideRemeberLoginState' => false,
+ 'throttle_delay' => 1000,
],
'guest'
);
@@ -311,6 +327,7 @@ class LoginControllerTest extends TestCase {
'rememberLoginState' => 0,
'resetPasswordLink' => false,
'hideRemeberLoginState' => false,
+ 'throttle_delay' => 1000,
],
'guest'
);