示例#1
0
    def test_playing_pausing(self):
        assert mp.setup(self.hass, {"media_player": {"platform": "demo"}})
        assert self.hass.states.is_state(entity_id, "playing")

        mp.media_pause(self.hass, entity_id)
        self.hass.pool.block_till_done()
        assert self.hass.states.is_state(entity_id, "paused")

        mp.media_play_pause(self.hass, entity_id)
        self.hass.pool.block_till_done()
        assert self.hass.states.is_state(entity_id, "playing")

        mp.media_play_pause(self.hass, entity_id)
        self.hass.pool.block_till_done()
        assert self.hass.states.is_state(entity_id, "paused")

        mp.media_play(self.hass, entity_id)
        self.hass.pool.block_till_done()
        assert self.hass.states.is_state(entity_id, "playing")
示例#2
0
    def test_playing_pausing(self):
        assert mp.setup(self.hass, {'media_player': {'platform': 'demo'}})
        assert self.hass.states.is_state(entity_id, 'playing')

        mp.media_pause(self.hass, entity_id)
        self.hass.pool.block_till_done()
        assert self.hass.states.is_state(entity_id, 'paused')

        mp.media_play_pause(self.hass, entity_id)
        self.hass.pool.block_till_done()
        assert self.hass.states.is_state(entity_id, 'playing')

        mp.media_play_pause(self.hass, entity_id)
        self.hass.pool.block_till_done()
        assert self.hass.states.is_state(entity_id, 'paused')

        mp.media_play(self.hass, entity_id)
        self.hass.pool.block_till_done()
        assert self.hass.states.is_state(entity_id, 'playing')
示例#3
0
    def test_playing_pausing(self):
        assert mp.setup(self.hass, {'media_player': {'platform': 'demo'}})
        assert self.hass.states.is_state(entity_id, 'playing')

        mp.media_pause(self.hass, entity_id)
        self.hass.pool.block_till_done()
        assert self.hass.states.is_state(entity_id, 'paused')

        mp.media_play_pause(self.hass, entity_id)
        self.hass.pool.block_till_done()
        assert self.hass.states.is_state(entity_id, 'playing')

        mp.media_play_pause(self.hass, entity_id)
        self.hass.pool.block_till_done()
        assert self.hass.states.is_state(entity_id, 'paused')

        mp.media_play(self.hass, entity_id)
        self.hass.pool.block_till_done()
        assert self.hass.states.is_state(entity_id, 'playing')
示例#4
0
    def test_playing_pausing(self):
        """Test media_pause."""
        assert setup_component(
            self.hass, mp.DOMAIN,
            {'media_player': {'platform': 'demo'}})
        assert self.hass.states.is_state(entity_id, 'playing')

        mp.media_pause(self.hass, entity_id)
        self.hass.block_till_done()
        assert self.hass.states.is_state(entity_id, 'paused')

        mp.media_play_pause(self.hass, entity_id)
        self.hass.block_till_done()
        assert self.hass.states.is_state(entity_id, 'playing')

        mp.media_play_pause(self.hass, entity_id)
        self.hass.block_till_done()
        assert self.hass.states.is_state(entity_id, 'paused')

        mp.media_play(self.hass, entity_id)
        self.hass.block_till_done()
        assert self.hass.states.is_state(entity_id, 'playing')
示例#5
0
    def test_playing_pausing(self):
        """Test media_pause."""
        assert setup_component(
            self.hass, mp.DOMAIN,
            {'media_player': {'platform': 'demo'}})
        assert self.hass.states.is_state(entity_id, 'playing')

        mp.media_pause(self.hass, entity_id)
        self.hass.block_till_done()
        assert self.hass.states.is_state(entity_id, 'paused')

        mp.media_play_pause(self.hass, entity_id)
        self.hass.block_till_done()
        assert self.hass.states.is_state(entity_id, 'playing')

        mp.media_play_pause(self.hass, entity_id)
        self.hass.block_till_done()
        assert self.hass.states.is_state(entity_id, 'paused')

        mp.media_play(self.hass, entity_id)
        self.hass.block_till_done()
        assert self.hass.states.is_state(entity_id, 'playing')