Skip to content

test: add real-server coverage for rate limiting and quick endpoint - #131

Merged
HC-ONLINE merged 4 commits into
mainfrom
fix/integration-api-gap-tests
Oct 27, 2026
Merged

HC-ONLINE merged 4 commits into
mainfrom
fix/integration-api-gap-tests

Conversation

@HC-ONLINE

Copy link
Copy Markdown
Owner

Pull Request Template

Description

Adds integration coverage for two gaps, replacing obsolete manual API scripts with tests written against the current contract:

  • Rate limiting over real HTTP (tests/integration/api/test_api_robustness.py): bursts past the configured limit against the live Uvicorn server and asserts 429 with a valid Retry-After header and a consistent JSON body. The burst size is derived from the effective test configuration (no hardcoded counts) and the assertions are guarded against the wall-clock window edge. The test fails if rate limiting is disabled, removed or no longer enforced.
  • Functional POST /api/quick/scan coverage (tests/integration/api/test_api_quick.py): real server, real auth, validation, QuickService, AnalyzeService and ScrapeService running against a controlled loopback target — no service mocks, no external services. Verifies the success contract of a low-preset scan (including proof that the scan actually reached the target), consent rejection (400 CONSENT_REQUIRED) and missing-key rejection (401).
  • The API integration conftest.py now pins test-relevant environment (rate limiting enabled; local-target opt-in for the controlled target) so results do not depend on a machine-local config file.
  • Removed an obsolete entry from AGENTS.md (File Locations).

Related Issue

None

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist

  • I have followed the style guidelines of this project (Ruff & Pyright)
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes (unit: 2032 passed, 3 skipped; integration API suite: 68 passed; each new test also passes 4 consecutive runs plus a negative check that it fails when the behaviour under test breaks)
  • I have updated the documentation accordingly

Screenshots (if applicable)

Not applicable

@HC-ONLINE
HC-ONLINE merged commit eb5a983 into main Oct 27, 2026
8 checks passed
@HC-ONLINE
HC-ONLINE deleted the fix/integration-api-gap-tests branch November 6, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant