'Test the current cover position.'

def test_current_cover_position(self):

    self.assertTrue(setup_component(self.hass, cover.DOMAIN, {cover.DOMAIN: {'platform': 'mqtt', 'name': 'test', 'state_topic': 'state-topic', 'command_topic': 'command-topic', 'payload_open': 'OPEN', 'payload_close': 'CLOSE', 'payload_stop': 'STOP'}}))
    state_attributes_dict = self.hass.states.get('cover.test').attributes
    self.assertFalse(('current_position' in state_attributes_dict))
    self.assertFalse(('current_tilt_position' in state_attributes_dict))
    self.assertFalse(((4 & self.hass.states.get('cover.test').attributes['supported_features']) == 4))
    fire_mqtt_message(self.hass, 'state-topic', '0')
    self.hass.block_till_done()
    current_cover_position = self.hass.states.get('cover.test').attributes['current_position']
    self.assertEqual(0, current_cover_position)
    fire_mqtt_message(self.hass, 'state-topic', '50')
    self.hass.block_till_done()
    current_cover_position = self.hass.states.get('cover.test').attributes['current_position']
    self.assertEqual(50, current_cover_position)
    fire_mqtt_message(self.hass, 'state-topic', '101')
    self.hass.block_till_done()
    current_cover_position = self.hass.states.get('cover.test').attributes['current_position']
    self.assertEqual(50, current_cover_position)
    fire_mqtt_message(self.hass, 'state-topic', 'non-numeric')
    self.hass.block_till_done()
    current_cover_position = self.hass.states.get('cover.test').attributes['current_position']
    self.assertEqual(50, current_cover_position)
