Closed sanjay900 closed 1 week ago
Don't have much experience with python tests, sorry!
The only HA test I've ever had to touch is this one. Note how it uses unittest.mock
to fake out the "pim" (their equivalent of the Panel
). I guess we'd have to do something similar.
There's also a HA script that generates a skeleton integration, including the tests. That might be a place to start.
Hey, so feel free to ask questions about testing. Config flow tests are quite easy, they require you to patch the library objects with mocks. Then you just programmatically enter the config flow and test the behavior of it all. Some nice integrations in core to look at are airgradient
or epion
.
One of the requirements for upstreaming is that we have tests, specifically there needs to be 100% coverage for
config_flow.py
but we may want to do more tests than that.