'Test the state text of a template.'

def test_template_state_text(self):

    with assert_setup_component(1, 'cover'):
        assert setup.setup_component(self.hass, 'cover', {'cover': {'platform': 'template', 'covers': {'test_template_cover': {'value_template': '{{    states.cover.test_state.state    }}', 'open_cover': {'service': 'cover.open_cover', 'entity_id': 'cover.test_state'}, 'close_cover': {'service': 'cover.close_cover', 'entity_id': 'cover.test_state'}}}}})
    self.hass.start()
    self.hass.block_till_done()
    state = self.hass.states.set('cover.test_state', STATE_OPEN)
    self.hass.block_till_done()
    state = self.hass.states.get('cover.test_template_cover')
    assert (state.state == STATE_OPEN)
    state = self.hass.states.set('cover.test_state', STATE_CLOSED)
    self.hass.block_till_done()
    state = self.hass.states.get('cover.test_template_cover')
    assert (state.state == STATE_CLOSED)
