Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add api tests #186

Merged
merged 3 commits into from
Sep 3, 2024
Merged

Add api tests #186

merged 3 commits into from
Sep 3, 2024

Conversation

peterdudfield
Copy link
Contributor

Pull Request

Description

Add api tests from #173
Fixes #

How Has This Been Tested?

CI tests

  • Yes

Checklist:

  • My code follows OCF's coding style guidelines
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked my code and corrected any misspellings

BraunRudolf and others added 2 commits August 30, 2024 08:03
* Add unit tests for api
only added two tests, many cases are covert by frontend

* Modify tests/api_tests/test_api.py
add assert

* Add an other test
add test_wrong_body

* Remove print statements

* Remove __pycache__/test_api.cpython-311-pytest-8.3.2.pyc

* Add variables for expected values

* Update api test to new requirements

* Add test_getenphse_authorization_url.py

* Add test_getenphse_token_and_system_id
- bad redirect url
- bad redirect url with correct param
- fixtures
@peterdudfield
Copy link
Contributor Author

@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
Copy link
Contributor Author

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
Copy link
Contributor

@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
Copy link
Contributor Author

@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
Copy link
Contributor

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
Copy link
Contributor Author

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

@peterdudfield peterdudfield merged commit 003c0e2 into main Sep 3, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants