diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-01-13 21:18:05 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-01-15 21:43:11 +0100 |
commit | b1d808470058f655fde6f29d04b542574a7a3e38 (patch) | |
tree | 53455d792298ab9040e0a4f46a3f7758e85a86ed /tests/Core/Controller | |
parent | 7cab7feb38b0456ac923869e7dad5976d2ab874a (diff) | |
download | nextcloud-server-b1d808470058f655fde6f29d04b542574a7a3e38.tar.gz nextcloud-server-b1d808470058f655fde6f29d04b542574a7a3e38.zip |
Fix tests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'tests/Core/Controller')
-rw-r--r-- | tests/Core/Controller/LoginControllerTest.php | 19 |
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' ); |