Skip to content

Conversation

@KhushamBansal
Copy link

Description

This PR adds comprehensive integration tests for the wind forecast CSV download endpoint. It ensures that the API correctly handles different forecast horizons and returns the expected CSV structure (including IST timezone formatting).

Fixes #74

Changes:

  • Created TestCsvDownload class in the test suite.
  • Added test_csv_download_success to verify the "latest" forecast horizon.
  • Added test_csv_download_day_ahead to verify future-dated forecast data retrieval.
  • Verified correct CSV headers: Date [IST], Time, and PowerMW.

How Has This Been Tested?

I have implemented and ran the following automated tests using pytest and the FastAPI TestClient:

  1. Latest Horizon Test: Verified that calling the endpoint returns a 200 status code and a valid CSV with data.
  2. Day Ahead Test: Verified that the endpoint correctly filters or identifies data meant for the next day's forecast.
  3. Structure Check: Asserted that response headers include the correct content-disposition for file downloads and that the pandas-parsed CSV contains the required columns.
  • Yes

Checklist:

  • My code follows OCF's coding style guidelines
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked my code and corrected any misspellings

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.

add test for csv file download

1 participant