diff options
author | Morris Jobke <hey@morrisjobke.de> | 2020-08-19 18:21:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-19 18:21:01 +0200 |
commit | 4c6eb96471b90c41e26bdf2cb3edf2cb15aec613 (patch) | |
tree | 49ea3b11915636e3f87640e24178b180939c8848 /tests | |
parent | 60be722ee8781d9e94ecc66d62c0e5fcb7e3934e (diff) | |
parent | e93bf713690047da6e48f882848c7f1ba832db4e (diff) | |
download | nextcloud-server-4c6eb96471b90c41e26bdf2cb3edf2cb15aec613.tar.gz nextcloud-server-4c6eb96471b90c41e26bdf2cb3edf2cb15aec613.zip |
Merge pull request #22280 from nextcloud/bugfix/noid/429-on-brute-force-maximum
Send "429 Too Many Requests" in case of brute force protection
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php | 4 | ||||
-rw-r--r-- | tests/lib/User/SessionTest.php | 12 |
2 files changed, 4 insertions, 12 deletions
diff --git a/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php index f8db85a9358..786bac6d856 100644 --- a/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php @@ -70,7 +70,7 @@ class BruteForceMiddlewareTest extends TestCase { ->willReturn('127.0.0.1'); $this->throttler ->expects($this->once()) - ->method('sleepDelay') + ->method('sleepDelayOrThrowOnMax') ->with('127.0.0.1', 'login'); /** @var Controller|\PHPUnit\Framework\MockObject\MockObject $controller */ @@ -92,7 +92,7 @@ class BruteForceMiddlewareTest extends TestCase { ->method('getRemoteAddress'); $this->throttler ->expects($this->never()) - ->method('sleepDelay'); + ->method('sleepDelayOrThrowOnMax'); /** @var Controller|\PHPUnit\Framework\MockObject\MockObject $controller */ $controller = $this->createMock(Controller::class); diff --git a/tests/lib/User/SessionTest.php b/tests/lib/User/SessionTest.php index 48c4785bf71..8fd94ffc004 100644 --- a/tests/lib/User/SessionTest.php +++ b/tests/lib/User/SessionTest.php @@ -1264,12 +1264,8 @@ class SessionTest extends \Test\TestCase { $this->throttler ->expects($this->once()) ->method('sleepDelay') - ->with('192.168.0.1'); - $this->throttler - ->expects($this->any()) - ->method('getDelay') ->with('192.168.0.1') - ->willReturn(0); + ->willReturn(5); $this->timeFactory ->expects($this->any()) ->method('getTime') @@ -1318,12 +1314,8 @@ class SessionTest extends \Test\TestCase { $this->throttler ->expects($this->once()) ->method('sleepDelay') - ->with('192.168.0.1'); - $this->throttler - ->expects($this->any()) - ->method('getDelay') ->with('192.168.0.1') - ->willReturn(0); + ->willReturn(5); $this->timeFactory ->expects($this->any()) ->method('getTime') |