2020-05-26 13:47:25 +00:00
|
|
|
"""Define fixtures for Elexa Guardian tests."""
|
2021-01-01 21:31:56 +00:00
|
|
|
from unittest.mock import patch
|
2020-05-26 13:47:25 +00:00
|
|
|
|
2021-01-01 21:31:56 +00:00
|
|
|
import pytest
|
2020-07-03 18:29:35 +00:00
|
|
|
|
2020-05-26 13:47:25 +00:00
|
|
|
|
|
|
|
@pytest.fixture()
|
|
|
|
def ping_client():
|
|
|
|
"""Define a patched client that returns a successful ping response."""
|
|
|
|
with patch(
|
|
|
|
"homeassistant.components.guardian.async_setup_entry", return_value=True
|
|
|
|
), patch("aioguardian.client.Client.connect"), patch(
|
2020-06-28 05:16:42 +00:00
|
|
|
"aioguardian.commands.system.SystemCommands.ping",
|
2020-05-26 13:47:25 +00:00
|
|
|
return_value={"command": 0, "status": "ok", "data": {"uid": "ABCDEF123456"}},
|
|
|
|
), patch(
|
|
|
|
"aioguardian.client.Client.disconnect"
|
|
|
|
):
|
|
|
|
yield
|