Add 100% coverage of Reolink host.py (#124577)

* Add 100% host test coverage

* Add missing test
This commit is contained in:
starkillerOG 2024-08-30 16:24:27 +02:00 committed by GitHub
parent d7fb245213
commit a8b55a16fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 320 additions and 9 deletions

View file

@ -437,7 +437,15 @@ class ReolinkHost:
self._long_poll_task.cancel()
self._long_poll_task = None
await self._api.unsubscribe(sub_type=SubType.long_poll)
try:
await self._api.unsubscribe(sub_type=SubType.long_poll)
except ReolinkError as err:
_LOGGER.error(
"Reolink error while unsubscribing from host %s:%s: %s",
self._api.host,
self._api.port,
err,
)
async def stop(self, event=None) -> None:
"""Disconnect the API."""
@ -511,9 +519,7 @@ class ReolinkHost:
)
if sub_type == SubType.push:
await self.subscribe()
else:
await self._api.subscribe(self._webhook_url, sub_type)
return
return
timer = self._api.renewtimer(sub_type)
_LOGGER.debug(