╔════════════════════════════════════════════════╗
║ PHASE 7: API SYSTEM TEST ║
╚════════════════════════════════════════════════╝
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
SECTION 1: API KEY MANAGEMENT (ApiKeyController)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ Generate API key
✅ API key preview fits VARCHAR(10)
✅ API key hash matches Security::hashApiKey
✅ List user API keys
✅ Maximum 5 active keys limit check
✅ Revoke API key
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
SECTION 2: API AUTHENTICATION (ApiAuthMiddleware)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ Valid API key lookup via hash
✅ Invalid API key returns no record
✅ Revoked key lookup check
✅ IP whitelist parsing
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
SECTION 3: API ENDPOINTS — HTTP TESTS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
❌ API request without key → 401 — Returned false (line 53)
❌ API request with invalid key → 401 — Returned false (line 53)
❌ GET /api/v1/balance → credit balance — HTTP 404:
404 Not Found
404
Not Found
The server cannot find the requested page:
(line 265)
❌ GET /api/v1/jobs → job list — HTTP 404:
404 Not Found
404
Not Found
The server cannot find the requested page:
(line 272)
❌ POST /api/v1/verify/single — valid email — HTTP 404:
404 Not Found
404
Not Found
The server cannot find the requested page:
(line 282)
❌ POST /api/v1/verify/single — invalid email → 422 — Returned false (line 53)
❌ POST /api/v1/verify/single — empty email → 422 — Returned false (line 53)
❌ POST /api/v1/verify/bulk — small batch — HTTP 404:
404 Not Found
404
Not Found
The server cannot find the requested page:
(line 308)
❌ POST /api/v1/verify/bulk — empty array → 422 — Returned false (line 53)
❌ POST /api/v1/verify/bulk — no emails field → 422 — Returned false (line 53)
❌ POST /api/v1/verify/bulk — deduplicates emails — HTTP 404:
404 Not Found
404
Not Found
The server cannot find the requested page:
(line 333)
❌ GET /api/v1/results/{jobId} — valid job — HTTP 404:
404 Not Found
404
Not Found
The server cannot find the requested page:
(line 356)
✅ GET /api/v1/results/{jobId} — non-existent job → 404
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
SECTION 4: API CREDIT DEDUCTION
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
❌ Single verify deducts 1 credit — HTTP 404:
404 Not Found
404
Not Found
The server cannot find the requested page:
(line 377)
❌ Bulk verify deducts correct credits — HTTP 404:
404 Not Found
404
Not Found
The server cannot find the requested page:
(line 388)
❌ Insufficient credits → 402 for single verify — Returned false (line 53)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
SECTION 5: API KEY LAST USED UPDATE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
❌ API key last_used_at is updated on request — Returned false (line 53)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
SECTION 6: HTTP API KEY MANAGEMENT PAGES
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
❌ User login for HTTP tests — No CSRF token found (line 467)
❌ GET /profile/api-keys page loads — Returned false (line 53)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
CLEANUP
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🧹 Test data cleaned up
╔════════════════════════════════════════════════╗
║ ⚠️ 11 passed, 18 failed out of 29 ║
╚════════════════════════════════════════════════╝