1
0
mirror of https://github.com/flarum/core.git synced 2025-08-05 16:07:34 +02:00

Move floodgate to middleware, add extender + integration tests (#2170)

This commit is contained in:
Alexander Skvortsov
2020-11-29 17:13:22 -05:00
committed by GitHub
parent 387b4fd315
commit 1a5e4d454e
14 changed files with 400 additions and 2 deletions

View File

@@ -64,4 +64,44 @@ class CreateTest extends TestCase
$this->assertEquals(201, $response->getStatusCode());
}
/**
* @test
*/
public function limited_by_throttler()
{
$this->send(
$this->request('POST', '/api/posts', [
'authenticatedAs' => 2,
'json' => [
'data' => [
'attributes' => [
'content' => 'reply with predetermined content for automated testing - too-obscure',
],
'relationships' => [
'discussion' => ['data' => ['id' => 1]],
],
],
],
])
);
$response = $this->send(
$this->request('POST', '/api/posts', [
'authenticatedAs' => 2,
'json' => [
'data' => [
'attributes' => [
'content' => 'Second reply with predetermined content for automated testing - too-obscure',
],
'relationships' => [
'discussion' => ['data' => ['id' => 1]],
],
],
],
])
);
$this->assertEquals(429, $response->getStatusCode());
}
}