Skip to content

Refactor round-trip search tests to mock HTTP client instead of hitting live API #104

@zspherez

Description

@zspherez

Problem

The round-trip search tests in tests/search/test_search_flights.py make real HTTP requests to the Google Flights API. Round-trip searches are especially slow because they make multiple sequential API calls (outbound results + return lookups for each). This causes frequent curl: (28) Operation timed out failures on CI runners.

Affected tests (currently commented out):

  • test_basic_round_trip_search
  • test_complex_round_trip_search
  • test_round_trip_with_selected_outbound
  • test_round_trip_result_structure

Proposed solution

Mock the HTTP client (fli.search.client) so these tests validate the round-trip search logic (recursive calls, result pairing, segment selection) without depending on network access. The one-way search tests in the same file have the same issue but are less prone to timeouts since they only make a single API call.

Ideally, all tests in tests/search/ should be refactored to mock the HTTP layer, with real API integration tests gated behind a separate marker (e.g. @pytest.mark.integration).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions