'Test the set_position command.'

def test_set_position(self):

    with assert_setup_component(1, 'cover'):
        assert setup.setup_component(self.hass, 'input_slider', {'input_slider': {'test': {'min': '0', 'max': '100', 'initial': '42'}}})
        assert setup.setup_component(self.hass, 'cover', {'cover': {'platform': 'template', 'covers': {'test_template_cover': {'position_template': '{{    states.input_slider.test.state    |    int    }}', 'set_cover_position': {'service': 'input_slider.select_value', 'entity_id': 'input_slider.test', 'data_template': {'value': '{{    position    }}'}}}}}})
    self.hass.start()
    self.hass.block_till_done()
    state = self.hass.states.set('input_slider.test', 42)
    self.hass.block_till_done()
    state = self.hass.states.get('cover.test_template_cover')
    assert (state.state == STATE_OPEN)
    cover.open_cover(self.hass, 'cover.test_template_cover')
    self.hass.block_till_done()
    state = self.hass.states.get('cover.test_template_cover')
    assert (state.attributes.get('current_position') == 100.0)
    cover.close_cover(self.hass, 'cover.test_template_cover')
    self.hass.block_till_done()
    state = self.hass.states.get('cover.test_template_cover')
    assert (state.attributes.get('current_position') == 0.0)
    cover.set_cover_position(self.hass, 25, 'cover.test_template_cover')
    self.hass.block_till_done()
    state = self.hass.states.get('cover.test_template_cover')
    assert (state.attributes.get('current_position') == 25.0)
