Skip to content

[Feature] /scan-url: add tests for URL validation and reachability checks #12

@lakshay122007

Description

@lakshay122007

Summary

Add unit tests for the /scan-url URL validation and reachability check logic added in #10.

Motivation

The validation logic in scan_url currently has no test coverage. Without tests, regressions in URL format checking, reachability detection, or timeout handling could go unnoticed.

Proposed solution

Add tests in the backend test suite that mock httpx to cover the following cases without making real network requests:

  • Invalid URL format returns 422
  • Non-existent repo (404 from GitHub HEAD request) returns 422
  • Network timeout returns 422 with "Could not reach GitHub" message
  • Valid public repo passes reachability check and proceeds normally

ML tier (if applicable)

  • Tier 1 — Triage (severity ranking, deduplication, false positive classification)
  • Tier 2 — Predictive (fix success prediction, exploit scoring, pattern clustering)
  • Tier 3 — Autonomous (LLM patch generation, self-healing pipeline)
  • Not ML-related

Acceptance criteria

  • Tests cover invalid URL format, 404, timeout, and 200 cases
  • httpx is mocked — no real network calls made during tests
  • Tests pass in CI across Python 3.10, 3.11, 3.12

Additional context

Follow-up to PR #10.

@ionfwsrijan Please assign this issue to me. thanks!

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions