Add template API endpoint

This commit is contained in:
Paulus Schoutsen 2015-12-09 23:56:20 -08:00
parent d1383ac94d
commit 47b5fbfaf3
3 changed files with 33 additions and 2 deletions

View file

@ -326,6 +326,20 @@ class TestAPI(unittest.TestCase):
self.assertEqual(1, len(test_value))
def test_api_template(self):
""" Test template API. """
hass.states.set('sensor.temperature', 10)
req = requests.post(
_url(const.URL_API_TEMPLATE),
data=json.dumps({"template":
'{{ states.sensor.temperature.state }}'}),
headers=HA_HEADERS)
hass.pool.block_till_done()
self.assertEqual('10', req.text)
def test_api_event_forward(self):
""" Test setting up event forwarding. """