openclimatefix / Elexonpy

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

Write comprehensive tests for mentioned API endpoints #38

Open 14Richa opened 2 months ago

14Richa commented 2 months ago

Detailed Description

Develop a test suite for the following API endpoints:

  1. Balancing
  2. Bid and offer
  3. RollingSystemDemandApi
  4. TemperatureApi
  5. Dataset
  6. LossOfLoadProbabilityAndDeRatedMarginApi
  7. General Forecast
  8. MarginForecastApi
  9. GeneralAPI
  10. NonBMSTORApi
  11. NonBMVolumesApi
  12. Indicated Forecast
  13. IndicativeImbalanceSettlementApi
  14. MarketIndexApi
  15. REMITApi
  16. SOSOPricesApi
  17. SurplusForecastApi
  18. SystemApi
  19. SystemForecastApi
  20. Availability
  21. Health check
  22. LegacyApi
yousefsawy commented 1 week ago

Hello, can you please provide more details on this? How do you want the test cases to be written? I cannot find any test case examples to look at.

I have written this test case but not sure if this satisfies the requirment. Please provide feedback.

    def test_datasets_abuc_get(self):
        """Test case for datasets_abuc_get

        Amount Of Balancing Reserves Under Contract (ABUC / B1720)  # noqa: E501
        """

        # Setting the parameters with arbitrary values
        publish_date_time_from = '2022-08-22T07:43:04Z'  # datetime
        publish_date_time_to = '2023-08-22T07:43:04Z'  # datetime 

        # Calling the api
        response = self.api.datasets_abuc_get(publish_date_time_from, publish_date_time_to)

        # Check if the response object is not None
        self.assertIsNotNone(response)

        # Check if the response contains data
        self.assertTrue(response.to_dict().get('data'))

File can be found at test/test_datasets_api.py

yousefsawy commented 1 week ago

@peterdudfield Can you please provide feedback?

peterdudfield commented 1 week ago

Hi @yousefsawy , thanks for this. Yes this is really good. I wonder if you could also the data fields in 'data' . So check the response is InsightsApiModelsResponsesDatasetResponse1InsightsApiModelsResponsesTransparencyDatasetRowsAbucDatasetRow as defined in the functiondescription

yousefsawy commented 1 week ago

Yes, I will do that and create more test cases.

peterdudfield commented 1 week ago

Thank you