Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tests/test_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,10 @@ def test_handle_reply_unexpected(app):
assert app.handle_message.call_args[0][6] == tsn
assert app.handle_message.call_args[0][7] == mock.sentinel.command_id
assert app.handle_message.call_args[0][8] == mock.sentinel.args


@pytest.mark.asyncio
async def test_shutdown(app):
app._api.close = mock.MagicMock()
await app.shutdown()
assert app._api.close.call_count == 1
4 changes: 4 additions & 0 deletions zigpy_deconz/zigbee/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ async def _reset_watchdog(self):
await self._api.write_parameter(NETWORK_PARAMETER['watchdog_ttl'][0], 3600)
await asyncio.sleep(1200)

async def shutdown(self):
"""Shutdown application."""
self._api.close()

async def startup(self, auto_form=False):
"""Perform a complete application startup"""
r = await self._api.version()
Expand Down