Ejemplo n.º 1
0
    def test_turning_off_and_on(self):
        assert mp.setup(self.hass, {"media_player": {"platform": "demo"}})
        assert self.hass.states.is_state(entity_id, "playing")

        mp.turn_off(self.hass, entity_id)
        self.hass.pool.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.pool.block_till_done()
        assert self.hass.states.is_state(entity_id, "playing")

        mp.toggle(self.hass, entity_id)
        self.hass.pool.block_till_done()
        assert self.hass.states.is_state(entity_id, "off")
        assert not mp.is_on(self.hass, entity_id)
Ejemplo n.º 2
0
    def test_turning_off_and_on(self):
        assert mp.setup(self.hass, {'media_player': {'platform': 'demo'}})
        assert self.hass.states.is_state(entity_id, 'playing')

        mp.turn_off(self.hass, entity_id)
        self.hass.pool.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.pool.block_till_done()
        assert self.hass.states.is_state(entity_id, 'playing')

        mp.toggle(self.hass, entity_id)
        self.hass.pool.block_till_done()
        assert self.hass.states.is_state(entity_id, 'off')
        assert not mp.is_on(self.hass, entity_id)
Ejemplo n.º 3
0
    def test_turning_off_and_on(self):
        assert mp.setup(self.hass, {'media_player': {'platform': 'demo'}})
        assert self.hass.states.is_state(entity_id, 'playing')

        mp.turn_off(self.hass, entity_id)
        self.hass.pool.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.pool.block_till_done()
        assert self.hass.states.is_state(entity_id, 'playing')

        mp.toggle(self.hass, entity_id)
        self.hass.pool.block_till_done()
        assert self.hass.states.is_state(entity_id, 'off')
        assert not mp.is_on(self.hass, entity_id)
Ejemplo n.º 4
0
    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')

        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)
Ejemplo n.º 5
0
    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')

        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)