'Test flash.'

def test_flash(self):

    with assert_setup_component(1, light.DOMAIN):
        assert setup_component(self.hass, light.DOMAIN, {light.DOMAIN: {'platform': 'mqtt_template', 'name': 'test', 'command_topic': 'test_light_rgb/set', 'command_on_template': 'on,{{    flash    }}', 'command_off_template': 'off', 'qos': 0}})
    state = self.hass.states.get('light.test')
    self.assertEqual(STATE_OFF, state.state)
    light.turn_on(self.hass, 'light.test', flash='short')
    self.hass.block_till_done()
    self.assertEqual('test_light_rgb/set', self.mock_publish.mock_calls[(-2)][1][0])
    self.assertEqual(0, self.mock_publish.mock_calls[(-2)][1][2])
    self.assertEqual(False, self.mock_publish.mock_calls[(-2)][1][3])
    payload = self.mock_publish.mock_calls[(-2)][1][1]
    self.assertEqual('on,short', payload)
    light.turn_on(self.hass, 'light.test', flash='long')
    self.hass.block_till_done()
    self.assertEqual('test_light_rgb/set', self.mock_publish.mock_calls[(-2)][1][0])
    self.assertEqual(0, self.mock_publish.mock_calls[(-2)][1][2])
    self.assertEqual(False, self.mock_publish.mock_calls[(-2)][1][3])
    payload = self.mock_publish.mock_calls[(-2)][1][1]
    self.assertEqual('on,long', payload)
