fix(test): 修正 AuthRateLimitTest 過期的 throttle 門檻斷言
commit 2a0e9255(P2 帳號鎖定上線)已將 member/provider 登入的 IP throttle 從 5,1 調整為 10,1(避免 IP throttle 搶在帳號鎖定的 423 之前觸發 429), 但測試的迴圈次數與註解仍停留在舊版 5,1,導致預期 429 卻收到 401。 同步將迴圈次數改為 10、區塊註解改為 throttle:10,1,使其對齊現行設定。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -17,11 +17,11 @@ class AuthRateLimitTest extends TestCase
|
|||||||
Cache::flush();
|
Cache::flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── member (throttle:5,1) ────────────────────────────────
|
// ── member (throttle:10,1) ───────────────────────────────
|
||||||
|
|
||||||
public function test_member_login_within_limit_is_not_throttled(): void
|
public function test_member_login_within_limit_is_not_throttled(): void
|
||||||
{
|
{
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 10; $i++) {
|
||||||
$response = $this->postJson('/api/member/login', [
|
$response = $this->postJson('/api/member/login', [
|
||||||
'email' => 'notexist@example.com',
|
'email' => 'notexist@example.com',
|
||||||
'password' => 'wrong',
|
'password' => 'wrong',
|
||||||
@@ -32,7 +32,7 @@ class AuthRateLimitTest extends TestCase
|
|||||||
|
|
||||||
public function test_member_login_exceeds_limit_returns_429(): void
|
public function test_member_login_exceeds_limit_returns_429(): void
|
||||||
{
|
{
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 10; $i++) {
|
||||||
$this->postJson('/api/member/login', [
|
$this->postJson('/api/member/login', [
|
||||||
'email' => 'notexist@example.com',
|
'email' => 'notexist@example.com',
|
||||||
'password' => 'wrong',
|
'password' => 'wrong',
|
||||||
@@ -48,11 +48,11 @@ class AuthRateLimitTest extends TestCase
|
|||||||
$this->assertTrue($response->headers->has('Retry-After'));
|
$this->assertTrue($response->headers->has('Retry-After'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── provider (throttle:5,1) ──────────────────────────────
|
// ── provider (throttle:10,1) ─────────────────────────────
|
||||||
|
|
||||||
public function test_provider_login_exceeds_limit_returns_429(): void
|
public function test_provider_login_exceeds_limit_returns_429(): void
|
||||||
{
|
{
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 10; $i++) {
|
||||||
$this->postJson('/api/provider/login', [
|
$this->postJson('/api/provider/login', [
|
||||||
'email' => 'notexist@example.com',
|
'email' => 'notexist@example.com',
|
||||||
'password' => 'wrong',
|
'password' => 'wrong',
|
||||||
|
|||||||
Reference in New Issue
Block a user