diff options
author | Joas Schilling <coding@schilljs.com> | 2023-08-15 08:04:32 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-08-21 16:36:04 +0200 |
commit | fd9b2d488e6083d6c1027551bb0190e5b7ee7a36 (patch) | |
tree | 4781506486a1950b19c28b2c8ff036e836e2bf03 /tests | |
parent | 2f06f2355d1f8a2963590c811c534a71dd7f0c7c (diff) | |
download | nextcloud-server-fd9b2d488e6083d6c1027551bb0190e5b7ee7a36.tar.gz nextcloud-server-fd9b2d488e6083d6c1027551bb0190e5b7ee7a36.zip |
feat: Expose if the own IP is allowed to bypass bruteforce protection
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Security/Bruteforce/CapabilitiesTest.php | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/lib/Security/Bruteforce/CapabilitiesTest.php b/tests/lib/Security/Bruteforce/CapabilitiesTest.php index 1c2bbb6bc53..d3463d307c0 100644 --- a/tests/lib/Security/Bruteforce/CapabilitiesTest.php +++ b/tests/lib/Security/Bruteforce/CapabilitiesTest.php @@ -52,18 +52,24 @@ class CapabilitiesTest extends TestCase { ); } - public function testGetCapabilities() { + public function testGetCapabilities(): void { $this->throttler->expects($this->atLeastOnce()) ->method('getDelay') ->with('10.10.10.10') ->willReturn(42); + $this->throttler->expects($this->atLeastOnce()) + ->method('isIPWhitelisted') + ->with('10.10.10.10') + ->willReturn(true); + $this->request->method('getRemoteAddress') ->willReturn('10.10.10.10'); $expected = [ 'bruteforce' => [ - 'delay' => 42 + 'delay' => 42, + 'allow-listed' => true, ] ]; $result = $this->capabilities->getCapabilities(); @@ -71,7 +77,7 @@ class CapabilitiesTest extends TestCase { $this->assertEquals($expected, $result); } - public function testGetCapabilitiesOnCli() { + public function testGetCapabilitiesOnCli(): void { $this->throttler->expects($this->atLeastOnce()) ->method('getDelay') ->with('') @@ -82,7 +88,8 @@ class CapabilitiesTest extends TestCase { $expected = [ 'bruteforce' => [ - 'delay' => 0 + 'delay' => 0, + 'allow-listed' => false, ] ]; $result = $this->capabilities->getCapabilities(); |