hass-core/tests/components/freebox/test_router.py
Quentame 923c13907c
Fix Freebox Home alarm & improve platform tests (#103475)
* Fix Freebox Home alarm

* Add trigger feature test & fix

* FreeboxCallSensor: Add test for missing coverage of new call

* Use generator

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Add test for arm_home feature (questions about the check)

* Stay focus on alam tests

* can_arm_home ==> if _command_arm_home

* Use one liner for supported_features

* Add idle state

* Fix rebase

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-11-20 15:01:18 +01:00

22 lines
637 B
Python

"""Tests for the Freebox utility methods."""
import json
from homeassistant.components.freebox.router import is_json
from .const import DATA_LAN_GET_HOSTS_LIST_MODE_BRIDGE, DATA_WIFI_GET_GLOBAL_CONFIG
async def test_is_json() -> None:
"""Test is_json method."""
# Valid JSON values
assert is_json("{}")
assert is_json('{ "simple":"json" }')
assert is_json(json.dumps(DATA_WIFI_GET_GLOBAL_CONFIG))
assert is_json(json.dumps(DATA_LAN_GET_HOSTS_LIST_MODE_BRIDGE))
# Not valid JSON values
assert not is_json(None)
assert not is_json("")
assert not is_json("XXX")
assert not is_json("{XXX}")