-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
259063f
commit 1bffc87
Showing
2 changed files
with
40 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
""" Test for main app """ | ||
|
||
from national import is_fake | ||
from pydantic_models import NationalForecastValue | ||
|
||
|
||
def test_is_fake_national_all_available_forecasts(monkeypatch, api_client): | ||
"""Test FAKE environment for all GSPs are populating | ||
with fake data. | ||
""" | ||
|
||
monkeypatch.setenv("FAKE", "1") | ||
assert is_fake() == 1 | ||
# Connect to DB endpoint | ||
response = api_client.get("/v0/solar/GB/national/forecast") | ||
assert response.status_code == 200 | ||
|
||
national_forecast_values = [NationalForecastValue(**f) for f in response.json()] | ||
assert national_forecast_values is not None | ||
|
||
# Disable is_fake environment | ||
monkeypatch.setenv("FAKE", "0") | ||
|
||
|
||
def test_is_fake_national_get_truths_for_all_gsps(monkeypatch, api_client): | ||
"""Test FAKE environment for all GSPs for yesterday and today | ||
are populating with fake data. | ||
""" | ||
|
||
monkeypatch.setenv("FAKE", "1") | ||
assert is_fake() == 1 | ||
# Connect to DB endpoint | ||
response = api_client.get("/v0/solar/GB/national/pvlive/") | ||
assert response.status_code == 200 | ||
|
||
national_forecast_values = [NationalForecastValue(**f) for f in response.json()] | ||
assert national_forecast_values is not None | ||
|
||
# Disable is_fake environment | ||
monkeypatch.setenv("FAKE", "0") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters