Re-allow splunk to report string states

Splunk *can* take string states, so un-fix that wrong fix.
pull/1216/head
Dan Smith 2016-02-12 02:20:15 +00:00
parent 7241762bcc
commit 484b7b64d7
2 changed files with 3 additions and 7 deletions

View File

@ -65,7 +65,7 @@ def setup(hass, config):
try:
_state = state_helper.state_as_number(state)
except ValueError:
return
_state = state.state
json_body = [
{

View File

@ -64,7 +64,8 @@ class TestSplunk(unittest.TestCase):
valid = {'1': 1,
'1.0': 1.0,
STATE_ON: 1,
STATE_OFF: 0}
STATE_OFF: 0,
'foo': 'foo'}
for in_, out in valid.items():
state = mock.MagicMock(state=in_,
domain='fake',
@ -86,8 +87,3 @@ class TestSplunk(unittest.TestCase):
payload['host'], data=payload,
headers={'Authorization': 'Splunk secret'})
self.mock_post.reset_mock()
for invalid in ('foo', '', object):
state = mock.MagicMock(state=invalid)
self.handler_method(mock.MagicMock(data={'new_state': state}))
self.assertFalse(self.mock_post.called)