'Test service call to command.'

def test_service_call_to_command(self):

    config = self.config_children_only
    config['commands'] = {'turn_off': {'service': 'test.turn_off', 'data': {}}}
    universal.validate_config(config)
    service = mock_service(self.hass, 'test', 'turn_off')
    ump = universal.UniversalMediaPlayer(self.hass, **config)
    ump.entity_id = media_player.ENTITY_ID_FORMAT.format(config['name'])
    run_coroutine_threadsafe(ump.async_update(), self.hass.loop).result()
    self.mock_mp_2._state = STATE_PLAYING
    self.mock_mp_2.schedule_update_ha_state()
    self.hass.block_till_done()
    run_coroutine_threadsafe(ump.async_update(), self.hass.loop).result()
    run_coroutine_threadsafe(ump.async_turn_off(), self.hass.loop).result()
    self.assertEqual(1, len(service))
