Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed Jan 23, 2024
1 parent f84882b commit df4b0f4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions pv_site_api/_db_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ def site_to_pydantic(site: SiteSQL) -> PVSiteMetadata:
inverter_capacity_kw=site.inverter_capacity_kw,
module_capacity_kw=site.module_capacity_kw,
created_utc=site.created_utc,
capacity_kw=site.capacity_kw,
)
return pv_site

Expand Down
1 change: 1 addition & 0 deletions pv_site_api/fake.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def make_fake_site() -> PVSites:
longitude=0,
inverter_capacity_kw=1,
module_capacity_kw=1.3,
capacity_kw=1,
)
pv_site_list = PVSites(
site_list=[pv_site],
Expand Down
4 changes: 2 additions & 2 deletions pv_site_api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ def post_site_info(

if is_fake():
print(f"Successfully added {site_info.dict()} for site {site_info.client_site_name}")
print("Not doing anything with it (yet!)")
return
site = make_fake_site().site_list[0]
return site

user = get_user_by_email(session=session, email=auth["https://openclimatefix.org/email"])

Expand Down
6 changes: 3 additions & 3 deletions tests/test_sites.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from pvsite_datamodel.sqlmodels import SiteSQL

from pv_site_api.pydantic_models import PVSiteMetadata, PVSites
from pv_site_api.pydantic_models import PVSiteInputMetadata, PVSites


def test_get_site_list_fake(client, fake):
Expand Down Expand Up @@ -48,7 +48,7 @@ def test_get_site_list_min(client, sites):


def test_put_site_fake(client, fake):
pv_site = PVSiteMetadata(
pv_site = PVSiteInputMetadata(
client_name="client_name_1",
client_site_id="the site id used by the user",
client_site_name="the site name",
Expand All @@ -72,7 +72,7 @@ def test_put_site_fake(client, fake):

def test_put_site(db_session, client):
# make site object
pv_site = PVSiteMetadata(
pv_site = PVSiteInputMetadata(
client_name="test_client",
client_site_id="1",
client_site_name="the site name",
Expand Down

0 comments on commit df4b0f4

Please sign in to comment.