Add 100% coverage of Reolink host.py (#124577)
* Add 100% host test coverage * Add missing test
This commit is contained in:
parent
d7fb245213
commit
a8b55a16fd
3 changed files with 320 additions and 9 deletions
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue