'Test turn_on and turn_off.'

def test_turning_off_and_on(self):

    assert setup_component(self.hass, mp.DOMAIN, {'media_player': {'platform': 'demo'}})
    assert self.hass.states.is_state(entity_id, 'playing')
    mp.turn_off(self.hass, entity_id)
    self.hass.block_till_done()
    assert self.hass.states.is_state(entity_id, 'off')
    assert (not mp.is_on(self.hass, entity_id))
    mp.turn_on(self.hass, entity_id)
    self.hass.block_till_done()
    assert self.hass.states.is_state(entity_id, 'playing')
    mp.toggle(self.hass, entity_id)
    self.hass.block_till_done()
    assert self.hass.states.is_state(entity_id, 'off')
    assert (not mp.is_on(self.hass, entity_id))
