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

tests: encapsulate mock calls inside tests and provide a new client for integrations tests #96

Closed palazzem closed 10 months ago

palazzem commented 10 months ago

Related Issues

None.

Proposed Changes:

ElmoClient tests are revamped, ditching the fixtures and wrapping all the code directly into the tests themselves. This move not only boosts readability but also shaves off unnecessary layers. Now we're directly calling the constructor rather than dancing around with a fixture.

As for the client fixture, it's now crafted to mimic the genuine client's behavior. While the calls are mocked, every step of data retrieval and processing goes unhindered. This ensures other components aren't misled by mock returns, and the client fixture can act as an integration tests fixture.

Testing:

Tests are improved in readability but coverage stays the same.

Extra Notes (optional):

client fixture is not used, but we plan to migrate all AlarmDevice tests to it in a new PR.

Checklist