Skip to content

Commit

Permalink
role back changes in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed Dec 20, 2024
1 parent 1bffc87 commit f97b183
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
23 changes: 8 additions & 15 deletions src/tests/test_gsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ def test_read_latest_one_gsp_national(db_session, api_client):

app.dependency_overrides[get_session] = lambda: db_session

# response = api_client.get("/v0/solar/GB/gsp/0/forecast")
response = api_client.get("/v0/solar/GB/gsp/forecast/0")
response = api_client.get("/v0/solar/GB/gsp/0/forecast")

assert response.status_code == 200

Expand Down Expand Up @@ -93,13 +92,13 @@ def test_read_latest_one_gsp_filter_creation_utc(db_session, api_client):
assert f[0].target_time == forecasts[1].forecast_values[0].target_time


def test_read_latest_all_gsp(db_session, api_client, gsp_ids=list(range(0, 10))):
def test_read_latest_all_gsp(db_session, api_client):
"""Check main solar/GB/gsp/forecast/all route works"""

model = get_model(session=db_session, name="blend", version="0.0.1")

forecasts = make_fake_forecasts(
gsp_ids=gsp_ids,
gsp_ids=list(range(0, 10)),
session=db_session,
t0_datetime_utc=datetime.now(tz=timezone.utc),
)
Expand All @@ -109,10 +108,7 @@ def test_read_latest_all_gsp(db_session, api_client, gsp_ids=list(range(0, 10)))

app.dependency_overrides[get_session] = lambda: db_session

gsp_ids_str = ", ".join(map(str, gsp_ids))
response = api_client.get(
f"/v0/solar/GB/gsp/forecast/all/?historic=False&gsp_ids={gsp_ids_str}"
)
response = api_client.get("/v0/solar/GB/gsp/forecast/all/?historic=False")

assert response.status_code == 200

Expand Down Expand Up @@ -172,13 +168,13 @@ def test_read_latest_gsp_id_equal_to_total(db_session, api_client):
_ = [ForecastValue(**f) for f in response.json()]


def test_read_latest_all_gsp_normalized(db_session, api_client, gsp_ids=list(range(0, 10))):
def test_read_latest_all_gsp_normalized(db_session, api_client):
"""Check main solar/GB/gsp/forecast/all normalized route works"""

model = get_model(session=db_session, name="blend", version="0.0.1")

forecasts = make_fake_forecasts(
gsp_ids=gsp_ids,
gsp_ids=list(range(0, 10)),
session=db_session,
t0_datetime_utc=datetime.now(tz=timezone.utc),
)
Expand All @@ -187,10 +183,7 @@ def test_read_latest_all_gsp_normalized(db_session, api_client, gsp_ids=list(ran

app.dependency_overrides[get_session] = lambda: db_session

gsp_ids_str = ", ".join(map(str, gsp_ids))
response = api_client.get(
f"/v0/solar/GB/gsp/forecast/all/?historic=False&normalize=True&gsp_ids={gsp_ids_str}"
)
response = api_client.get("/v0/solar/GB/gsp/forecast/all/?historic=False&normalize=True")

assert response.status_code == 200

Expand Down Expand Up @@ -298,7 +291,7 @@ def test_read_pvlive_for_gsp_id_over_total(db_session, api_client):
"""Check solar/GB/gsp/pvlive returns 204 when gsp_id over total"""

gsp_id = 318
response = api_client.get(f"/v0/solar/GB/gsp/{gsp_id}/pvlive")
response = api_client.get(f"/v0/solar/GB/gsp/pvlive/{gsp_id}")

assert response.status_code == 204

Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_merged_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_read_forecast_values_gsp(db_session, api_client):

app.dependency_overrides[get_session] = lambda: db_session

response = api_client.get("/v0/solar/GB/gsp/forecast/1")
response = api_client.get("/v0/solar/GB/gsp/1/forecast")
assert response.status_code == 200

r_json = response.json()
Expand Down
3 changes: 1 addition & 2 deletions src/tests/test_national.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,8 @@ def test_read_truth_national_gsp(db_session, api_client):
db_session.add_all([gsp_yield_1_sql, gsp_yield_2_sql, gsp_yield_3_sql, gsp_sql_1])

app.dependency_overrides[get_session] = lambda: db_session
yield db_session

response = api_client.get("/v0/solar/GB/national/pvlive/0")
response = api_client.get("/v0/solar/GB/national/0/pvlive")
assert response.status_code == 200

r_json = response.json()
Expand Down

0 comments on commit f97b183

Please sign in to comment.