palazzem / econnect-python

API adapter used to control programmatically an Elmo alarm system
BSD 3-Clause "New" or "Revised" License
8 stars 5 forks source link

refactor!: `AlarmDevice` uses integration test client to ensure `update()` compatibility with the new API #97

Closed palazzem closed 1 year ago

palazzem commented 1 year ago

Related Issues

None.

Proposed Changes:

This PR enhances the testing infrastructure by using a client fixture (see #96) that simulates the behavior of a real client. Additionally, we've addressed an incompatibility issue with this change. Key modifications in this PR include:

  1. Implementation of the client fixture for more realistic testing without invoking the real client, or relying on mocks.
  2. Refactoring of AlarmDevice.update() to leverage the new API. While initial tests passed, there were undetected operational issues that are now resolved.
  3. AlarmDevice methods now log errors.
  4. Breaking Change: The AlarmDevice.connect() method no longer invokes update(). This change streamlines the method's responsibility and simplifies the testing process, even though it initially appeared to be a beneficial shortcut.

Testing:

n/a

Extra Notes (optional):

This change is a breaking change and requires to update the HA integration.

Checklist