-
-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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 sensor tests for APSystems #117512
base: dev
Are you sure you want to change the base?
Add sensor tests for APSystems #117512
Conversation
Hey there @mawoka-myblock, @SonnenladenGmbH, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really understand the usage of syrupy library, but you'll have done the right thing, so thank you!
It will generate the .ambr files from what you compare them with. You can rerun them via |
@@ -131,6 +131,7 @@ class ApSystemsSensorWithDescription( | |||
"""Base sensor to be used with description.""" | |||
|
|||
entity_description: ApsystemsLocalApiSensorDescription | |||
_attr_has_entity_name = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this related, as the PR description says that tests are added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It kind of fixes a bug, but this is a new integration so I thought I'd merge them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just created a PR to add a BaseEntity which would make this irrelevant as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be clean to split this and then add the tests.
mock_api.get_device_info.return_value = ReturnDeviceInfo( | ||
deviceId="MY_SERIAL_NUMBER", | ||
devVer="1.0.0", | ||
ssid="MY_SSID", | ||
ipAddr="127.0.01", | ||
minPower=0, | ||
maxPower=1000, | ||
) | ||
mock_api.get_output_data.return_value = ReturnOutputData( | ||
p1=2.0, | ||
e1=3.0, | ||
te1=4.0, | ||
p2=5.0, | ||
e2=6.0, | ||
te2=7.0, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be it is better to use MagicMock here instead of importing dataclasses from library.
Proposed change
Add sensor tests for APSystems
Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: