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

fix(client): raise `InvalidToken` if the token expires while using `lock()` #134

Closed palazzem closed 6 months ago

palazzem commented 6 months ago

Related Issues

Proposed Changes:

lock() method uses the @contextmanager decorator that doesn't propagate inner exception. If a 401 response is received (the token is expired), that error is not propagated above and it causes the token to not get refreshed until the next poll(). In a real scenario where you have delays, it means it's very likely that you can't interact with the system unless you hit the exact window between one refresh and another.

Testing:

Acquire a token, let it expire, call lock()

Extra Notes (optional):

n/a

Checklist

coveralls commented 6 months ago

Pull Request Test Coverage Report for Build 7278102786


Totals Coverage Status
Change from base Build 7115497080: 0.0%
Covered Lines: 392
Relevant Lines: 392

💛 - Coveralls