openclimatefix / open-source-quartz-solar-forecast

Open Source Solar Site Level Forecast
MIT License
69 stars 55 forks source link

Add api tests #186

Closed peterdudfield closed 2 months ago

peterdudfield commented 2 months ago

Pull Request

Description

Add api tests from #173 Fixes #

How Has This Been Tested?

CI tests

peterdudfield commented 2 months ago

@BraunRudolf following on from #173 i tried to get the test working, but they failed. Do you have time to look at this?

I also put an issue in about tests not passing on external github accounts - #187

peterdudfield commented 2 months ago

I suspect its something to do with these not being set -

Screenshot 2024-08-30 at 08 17 59

but im not sure if they need to be set for these tests?

BraunRudolf commented 2 months ago

@peterdudfield the commit 3e11e48 implemented a class for the enphase with pydantic model.

class EnphaseSettings(BaseSettings):
    model_config = SettingsConfigDict(env_file='.env', extra='ignore')

    client_id: str = Field(alias="ENPHASE_CLIENT_ID")
    system_id: str = Field(alias="ENPHASE_SYSTEM_ID")
    api_key: str = Field(alias="ENPHASE_API_KEY")
    client_secret: str = Field(alias="ENPHASE_CLIENT_SECRET")

I guess the easiest thing would be to remove the enphase tests and rewrite them.

peterdudfield commented 2 months ago

@peterdudfield the commit 3e11e48 implemented a class for the enphase with pydantic model.

class EnphaseSettings(BaseSettings):
    model_config = SettingsConfigDict(env_file='.env', extra='ignore')

    client_id: str = Field(alias="ENPHASE_CLIENT_ID")
    system_id: str = Field(alias="ENPHASE_SYSTEM_ID")
    api_key: str = Field(alias="ENPHASE_API_KEY")
    client_secret: str = Field(alias="ENPHASE_CLIENT_SECRET")

I guess the easiest thing would be to remove the enphase tests and rewrite them.

yea, maybe I could skip that test for the moment. Until we would out a way to get that test working. its tricky becasue I cant make the variables public

BraunRudolf commented 2 months ago

Patching the last three tests with dummy strings could do the trick. If you could either delete the last three tests or comment them out, and then merge to main, I would try to fix them on a new branch.

peterdudfield commented 2 months ago

Ill merge this in @BraunRudolf , thanks, and let you do a different PR