Fix recorder crash for long state string - enforce at core level (#9696)

* Recorder exception catch for long state string

* Revert - Recorder exception catch for long state string

* Validate state length at core level

* Revert - this reverts commit 9d6bd017d96f20c10204d9bcb71573e3bc005ee3.

* Revert - Recorder exception catch for long state string

* Fix state TypeError

* Test for long state exception
This commit is contained in:
milanvo 2017-10-25 18:05:30 +02:00 committed by Paulus Schoutsen
parent fc8940111d
commit 7987065ad7
3 changed files with 26 additions and 3 deletions

View file

@ -12,7 +12,8 @@ import pytz
import pytest
import homeassistant.core as ha
from homeassistant.exceptions import InvalidEntityFormatError
from homeassistant.exceptions import (InvalidEntityFormatError,
InvalidStateError)
from homeassistant.util.async import run_coroutine_threadsafe
import homeassistant.util.dt as dt_util
from homeassistant.util.unit_system import (METRIC_SYSTEM)
@ -421,6 +422,10 @@ class TestState(unittest.TestCase):
InvalidEntityFormatError, ha.State,
'invalid_entity_format', 'test_state')
self.assertRaises(
InvalidStateError, ha.State,
'domain.long_state', 't' * 256)
def test_domain(self):
"""Test domain."""
state = ha.State('some_domain.hello', 'world')