* Add HmIP-DLD * Remove commented code * Fix errors * Format using black * Fix device count * Add missing tests * Apply changes by reviewer * Change setup entry code * Remove jammed state * Add error messages * Update homeassistant/components/homematicip_cloud/helpers.py Co-authored-by: Aaron Bach <bachya1208@gmail.com> * Add decorator * Add error log output * Update test_device.py --------- Co-authored-by: Aaron Bach <bachya1208@gmail.com>
18 lines
589 B
Python
18 lines
589 B
Python
"""Test HomematicIP Cloud helper functions."""
|
|
|
|
import json
|
|
|
|
from homeassistant.components.homematicip_cloud.helpers import is_error_response
|
|
|
|
|
|
async def test_is_error_response():
|
|
"""Test, if an response is a normal result or an error."""
|
|
assert not is_error_response("True")
|
|
assert not is_error_response(True)
|
|
assert not is_error_response("")
|
|
assert is_error_response(
|
|
json.loads(
|
|
'{"errorCode": "INVALID_NUMBER_PARAMETER_VALUE", "minValue": 0.0, "maxValue": 1.01}'
|
|
)
|
|
)
|
|
assert not is_error_response(json.loads('{"errorCode": ""}'))
|