diff --git a/src/tests/test_gsp.py b/src/tests/test_gsp.py index ed68bfd..b7e72e7 100644 --- a/src/tests/test_gsp.py +++ b/src/tests/test_gsp.py @@ -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 @@ -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), ) @@ -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 @@ -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), ) @@ -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 @@ -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 diff --git a/src/tests/test_merged_routes.py b/src/tests/test_merged_routes.py index 91671b8..dad18c5 100644 --- a/src/tests/test_merged_routes.py +++ b/src/tests/test_merged_routes.py @@ -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() diff --git a/src/tests/test_national.py b/src/tests/test_national.py index 583083b..690fe59 100644 --- a/src/tests/test_national.py +++ b/src/tests/test_national.py @@ -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()