def test_turning_off_and_on(self): """Test turn_on and turn_off.""" assert setup_component( self.hass, mp.DOMAIN, {"media_player": {"platform": "demo"}} ) assert self.hass.states.is_state(entity_id, "playing") common.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) common.turn_on(self.hass, entity_id) self.hass.block_till_done() assert self.hass.states.is_state(entity_id, "playing") common.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)
def test_turning_off_and_on(self): """Test turn_on and turn_off.""" assert setup_component( self.hass, mp.DOMAIN, {'media_player': {'platform': 'demo'}}) assert self.hass.states.is_state(entity_id, 'playing') common.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) common.turn_on(self.hass, entity_id) self.hass.block_till_done() assert self.hass.states.is_state(entity_id, 'playing') common.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)