From 3f4a6ba964d4c88a7c99efd7ba34ce407884a1e1 Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Wed, 31 Jul 2024 14:27:18 +0100 Subject: [PATCH] first try at mocking elexon api --- src/tests/test_elexon_forecast.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/tests/test_elexon_forecast.py b/src/tests/test_elexon_forecast.py index 07f4501..666b34c 100644 --- a/src/tests/test_elexon_forecast.py +++ b/src/tests/test_elexon_forecast.py @@ -23,16 +23,14 @@ def mock_data(): } -def test_get_elexon_forecast_with_data(mock_data): +def test_get_elexon_forecast_with_data(mock_data, api_client): with requests_mock.Mocker() as m: url = ( - f"{API_URL}?start_datetime_utc=2024-07-22T10:56:59.194610" - f"&end_datetime_utc=2024-07-28T10:56:59.194680" - f"&process_type=Day Ahead" + f"https://data.elexon.co.uk/bmrs/api/v1/forecast/generation/wind-and-solar/day-ahead" ) m.get(url, json=mock_data, headers={"Content-Type": "application/json"}) - response = requests.get(url) + response = api_client.get(url) print("Response Headers:", response.headers) # Assertions assert response.status_code == 200