Skip to content

Latest commit

 

History

History
60 lines (37 loc) · 1.54 KB

File metadata and controls

60 lines (37 loc) · 1.54 KB

Manual test cases

Run the app first: uvicorn app.main:app --reload


Test case 1: Single-day export

Goal: Export leads for one day only.

Request:

curl -o single_day.csv "http://127.0.0.1:8000/export/leads.csv?start_date=2025-02-15&end_date=2025-02-15"

Expected:

  • Status: 200 OK
  • File single_day.csv is downloaded.
  • Headers: Content-Type: text/csv; charset=utf-8, Content-Disposition: attachment; filename="leads_export_YYYYMMDD.csv", Cache-Control: no-store
  • CSV has header row: id,email,status,created_at
  • Data rows only include leads where created_at >= 2025-02-15 00:00:00 and created_at < 2025-02-16 00:00:00 (single day).

Test case 2: Multi-day export

Goal: Export leads over a date range.

Request:

curl -o multi_day.csv "http://127.0.0.1:8000/export/leads.csv?start_date=2025-02-01&end_date=2025-03-01"

Expected:

  • Status: 200 OK
  • File multi_day.csv is downloaded.
  • Rows include leads with created_at from 2025-02-01 00:00:00 up to (but not including) 2025-03-02 00:00:00 (i.e. through end of 2025-03-01).

Test case 3: Invalid date (expect 422)

Goal: Invalid date format returns 422 Unprocessable Entity.

Request:

curl -v "http://127.0.0.1:8000/export/leads.csv?start_date=2025-13-01&end_date=2025-03-01"

Expected:

  • Status: 422 Unprocessable Entity
  • Response body includes error detail (e.g. invalid date format or validation error).

Optional: Test with end_date=not-a-date or start_date=02-01-2025 and confirm 422.