aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFlorian Klinger <florian.klinger@nextcloud.com>2024-03-12 10:53:14 +0100
committerAndrey Borysenko <andrey18106x@gmail.com>2024-03-18 20:09:15 +0200
commitf3a4abd98cc84f3ecdfd4421015d310a731ecb2d (patch)
tree72d7a0d019a6433f42b95fcc49f236837850e5ca /tests
parent133a17aa96f3778a8c527cf096eb5a575df24e84 (diff)
downloadnextcloud-server-f3a4abd98cc84f3ecdfd4421015d310a731ecb2d.tar.gz
nextcloud-server-f3a4abd98cc84f3ecdfd4421015d310a731ecb2d.zip
fix: add check for app_api_system session flag to bypass rate limit
Signed-off-by: Florian Klinger <florian.klinger@nextcloud.com> Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/AppFramework/Middleware/Security/RateLimitingMiddlewareTest.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/lib/AppFramework/Middleware/Security/RateLimitingMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/RateLimitingMiddlewareTest.php
index 47d479b18a1..c0988ff5a11 100644
--- a/tests/lib/AppFramework/Middleware/Security/RateLimitingMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/Security/RateLimitingMiddlewareTest.php
@@ -37,6 +37,7 @@ use OCP\AppFramework\Http\Attribute\UserRateLimit;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IRequest;
+use OCP\ISession;
use OCP\IUser;
use OCP\IUserSession;
use PHPUnit\Framework\MockObject\MockObject;
@@ -77,6 +78,7 @@ class RateLimitingMiddlewareTest extends TestCase {
private IUserSession|MockObject $userSession;
private ControllerMethodReflector $reflector;
private Limiter|MockObject $limiter;
+ private ISession|MockObject $session;
private RateLimitingMiddleware $rateLimitingMiddleware;
protected function setUp(): void {
@@ -86,12 +88,14 @@ class RateLimitingMiddlewareTest extends TestCase {
$this->userSession = $this->createMock(IUserSession::class);
$this->reflector = new ControllerMethodReflector();
$this->limiter = $this->createMock(Limiter::class);
+ $this->session = $this->createMock(ISession::class);
$this->rateLimitingMiddleware = new RateLimitingMiddleware(
$this->request,
$this->userSession,
$this->reflector,
- $this->limiter
+ $this->limiter,
+ $this->session
);
}