mirror of
https://github.com/nextcloud/server.git
synced 2026-02-19 02:38:40 -05:00
test: enable rate limiting for ratelimiting.feature
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
This commit is contained in:
parent
59d1a49acc
commit
75063cd71b
3 changed files with 42 additions and 0 deletions
|
|
@ -243,3 +243,14 @@ default:
|
|||
regular_user_password: 123456
|
||||
- RemoteContext:
|
||||
remote: http://localhost:8080
|
||||
|
||||
ratelimiting:
|
||||
paths:
|
||||
- "%paths.base%/../ratelimiting_features"
|
||||
contexts:
|
||||
- RateLimitingContext:
|
||||
baseUrl: http://localhost:8080
|
||||
admin:
|
||||
- admin
|
||||
- admin
|
||||
regular_user_password: 123456
|
||||
30
build/integration/features/bootstrap/RateLimitingContext.php
Normal file
30
build/integration/features/bootstrap/RateLimitingContext.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
use Behat\Behat\Context\Context;
|
||||
|
||||
class RateLimitingContext implements Context {
|
||||
use BasicStructure;
|
||||
use CommandLine;
|
||||
use Provisioning;
|
||||
|
||||
/**
|
||||
* @BeforeScenario @RateLimiting
|
||||
*/
|
||||
public function enableRateLimiting() {
|
||||
// Enable rate limiting for the tests.
|
||||
// Ratelimiting is disabled by default, so we need to enable it
|
||||
$this->runOcc(['config:system:set', 'ratelimit.protection.enabled', '--value', 'true', '--type', 'bool']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @AfterScenario @RateLimiting
|
||||
*/
|
||||
public function disableRateLimiting() {
|
||||
// Restore the default rate limiting configuration.
|
||||
// Ratelimiting is disabled by default, so we need to disable it
|
||||
$this->runOcc(['config:system:set', 'ratelimit.protection.enabled', '--value', 'false', '--type', 'bool']);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
# SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
@RateLimiting
|
||||
Feature: ratelimiting
|
||||
|
||||
Background:
|
||||
Loading…
Reference in a new issue