Skip to content

Write a comprehensive integration test suite for all HTTP endpoints #190

@mftee

Description

@mftee

Write a comprehensive integration test suite for all HTTP endpoints in the Rust service. Tests must spin up a real Axum server and make actual HTTP requests using a test client, with mocked Stellar and Redis backends.

Requirements:

  • Use axum-test or tower::ServiceExt to create a test router without binding to a port
  • Create test fixtures and helpers:
    • test_app() — builds the full Axum router with mocked StellarClient and in-memory state
    • mock_stellar_verify(hash, verified) — configures the mock to return a given result
    • valid_sha256() — helper that returns a random valid SHA-256 hex string
  • Write integration tests for every endpoint:
    • GET /health → 200
    • GET /metrics → 200 with Prometheus content
    • POST /verify — valid hash → 200; invalid hash → 400; Stellar failure → 500
    • GET /verify/:hash — same as above via GET
    • POST /verify/batch — valid batch; too many hashes → 400; empty → 400
    • GET /verify/:hash/history — found; not found → 404
    • POST /submit — valid submission; missing secret key → appropriate error
    • POST /revoke — existing hash; non-existent hash → 404
    • POST /transfer — valid; invalid date → 400
  • All tests must be independent (no shared state between tests)

Acceptance Criteria:

  • All endpoint tests pass with cargo test
  • No tests share mutable state
  • Test coverage includes both happy path and error cases for every endpoint
  • Tests run without any external services (no real Redis, no real Stellar)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions