openclimatefix / Elexonpy

Python package wrapper around Elexon api
MIT License
12 stars 4 forks source link

Add tests for DemandApi endpoints #39

Closed 14Richa closed 3 months ago

14Richa commented 3 months ago

Description

This PR adds unit tests for the DemandApi class and covers various endpoints related to demand data, including actual total load, daily outturn, and streaming data. The new tests cover scenarios including successful API calls, empty responses, error handling, and parameter validation.

Changes

Added following test methods in the TestDemandApi class:

  1. test_demand_actual_total_get
  2. test_demand_outturn_daily_get
  3. test_demand_outturn_daily_stream_get
  4. test_demand_outturn_daily_stream_get_empty
  5. test_demand_outturn_daily_stream_get_error
  6. test_demand_outturn_get
  7. test_demand_outturn_get_empty
  8. test_demand_outturn_get_error
  9. test_demand_outturn_get_with_parameters

Testing

To run the new tests:

  1. Navigate to the project directory
  2. Run python -m unittest test_demand_api.py

Checklist:

peterdudfield commented 3 months ago

Also, could you run the tests with pytest please

peterdudfield commented 3 months ago

Ill close this, as we decided to do it a different way