summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-08-15 08:04:32 +0200
committerJoas Schilling <coding@schilljs.com>2023-08-23 06:44:07 +0200
commitb55359b23c92bab55fadfcf7cd0148ba56faa79b (patch)
treea7dd0ef0aa6c88761f31313902832513e6a4b7de /tests/lib
parent5c0789197f2f8f6d4ca088d28f4aae2fc4b8e351 (diff)
downloadnextcloud-server-b55359b23c92bab55fadfcf7cd0148ba56faa79b.tar.gz
nextcloud-server-b55359b23c92bab55fadfcf7cd0148ba56faa79b.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/lib')
-rw-r--r--tests/lib/Security/Bruteforce/CapabilitiesTest.php15
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();