Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-04-23 11:21:14 +0300
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2021-04-27 16:39:52 +0300
commit2b0fd23ecf89fb9b5d662e586982c26c16ff1f33 (patch)
tree1a0199b9da5c46f6a237c25a81b4f4db15657ce1 /tests
parentf369fdaf943f9130debe440099b227c732e91e38 (diff)
Fix ratelimit template
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/AppFramework/Middleware/Security/RateLimitingMiddlewareTest.php20
1 files changed, 9 insertions, 11 deletions
diff --git a/tests/lib/AppFramework/Middleware/Security/RateLimitingMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/RateLimitingMiddlewareTest.php
index 0d27a9a070f..aa713b99156 100644
--- a/tests/lib/AppFramework/Middleware/Security/RateLimitingMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/Security/RateLimitingMiddlewareTest.php
@@ -26,13 +26,16 @@ use OC\AppFramework\Utility\ControllerMethodReflector;
use OC\Security\RateLimiting\Exception\RateLimitExceededException;
use OC\Security\RateLimiting\Limiter;
use OCP\AppFramework\Controller;
-use OCP\AppFramework\Http\JSONResponse;
+use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IRequest;
use OCP\IUser;
use OCP\IUserSession;
use Test\TestCase;
+/**
+ * @group DB
+ */
class RateLimitingMiddlewareTest extends TestCase {
/** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */
private $request;
@@ -250,11 +253,7 @@ class RateLimitingMiddlewareTest extends TestCase {
->willReturn('JSON');
$result = $this->rateLimitingMiddleware->afterException($controller, 'testMethod', new RateLimitExceededException());
- $expected = new JSONResponse(
- [
- 'message' => 'Rate limit exceeded',
- ],
- 429
+ $expected = new DataResponse([], 429
);
$this->assertEquals($expected, $result);
}
@@ -271,13 +270,12 @@ class RateLimitingMiddlewareTest extends TestCase {
$result = $this->rateLimitingMiddleware->afterException($controller, 'testMethod', new RateLimitExceededException());
$expected = new TemplateResponse(
'core',
- '403',
- [
- 'file' => 'Rate limit exceeded',
- ],
- 'guest'
+ '429',
+ [],
+ TemplateResponse::RENDER_AS_GUEST
);
$expected->setStatus(429);
$this->assertEquals($expected, $result);
+ $this->assertIsString($result->render());
}
}