Files
hacs_integration/tests/tasks/test_setup_websocket_api.py
2021-11-21 17:20:24 +01:00

21 lines
590 B
Python

# pylint: disable=missing-function-docstring,missing-module-docstring, protected-access
from unittest.mock import patch
import pytest
from custom_components.hacs.base import HacsBase
@pytest.mark.asyncio
async def test_setup_websocket_api(hacs: HacsBase):
await hacs.tasks.async_load()
task = hacs.tasks.get("setup_websocket_api")
assert task
with patch(
"custom_components.hacs.tasks.setup_websocket_api.async_register_command"
) as mock_async_register_command:
await task.execute_task()
assert mock_async_register_command.call_count == 9