Skip to content

Commit

Permalink
first try at mocking elexon api
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed Jul 31, 2024
1 parent a6b5e1b commit 3f4a6ba
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/tests/test_elexon_forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3f4a6ba

Please sign in to comment.