Exemple #1
0
    def test_prev_next_track(self):
        assert mp.setup(self.hass, {'media_player': {'platform': 'demo'}})
        state = self.hass.states.get(entity_id)
        assert 1 == state.attributes.get('media_track')
        assert 0 == (mp.SUPPORT_PREVIOUS_TRACK
                     & state.attributes.get('supported_media_commands'))

        mp.media_next_track(self.hass, entity_id)
        self.hass.pool.block_till_done()
        state = self.hass.states.get(entity_id)
        assert 2 == state.attributes.get('media_track')
        assert 0 < (mp.SUPPORT_PREVIOUS_TRACK
                    & state.attributes.get('supported_media_commands'))

        mp.media_next_track(self.hass, entity_id)
        self.hass.pool.block_till_done()
        state = self.hass.states.get(entity_id)
        assert 3 == state.attributes.get('media_track')
        assert 0 < (mp.SUPPORT_PREVIOUS_TRACK
                    & state.attributes.get('supported_media_commands'))

        mp.media_previous_track(self.hass, entity_id)
        self.hass.pool.block_till_done()
        state = self.hass.states.get(entity_id)
        assert 2 == state.attributes.get('media_track')
        assert 0 < (mp.SUPPORT_PREVIOUS_TRACK
                    & state.attributes.get('supported_media_commands'))
    def test_prev_next_track(self):
        assert mp.setup(self.hass, {'media_player': {'platform': 'demo'}})
        state = self.hass.states.get(entity_id)
        assert 1 == state.attributes.get('media_track')
        assert 0 == (mp.SUPPORT_PREVIOUS_TRACK &
                     state.attributes.get('supported_media_commands'))

        mp.media_next_track(self.hass, entity_id)
        self.hass.pool.block_till_done()
        state = self.hass.states.get(entity_id)
        assert 2 == state.attributes.get('media_track')
        assert 0 < (mp.SUPPORT_PREVIOUS_TRACK &
                    state.attributes.get('supported_media_commands'))

        mp.media_next_track(self.hass, entity_id)
        self.hass.pool.block_till_done()
        state = self.hass.states.get(entity_id)
        assert 3 == state.attributes.get('media_track')
        assert 0 < (mp.SUPPORT_PREVIOUS_TRACK &
                    state.attributes.get('supported_media_commands'))

        mp.media_previous_track(self.hass, entity_id)
        self.hass.pool.block_till_done()
        state = self.hass.states.get(entity_id)
        assert 2 == state.attributes.get('media_track')
        assert 0 < (mp.SUPPORT_PREVIOUS_TRACK &
                    state.attributes.get('supported_media_commands'))
Exemple #3
0
    def test_prev_next_track(self):
        """Test media_next_track and media_previous_track ."""
        assert setup_component(self.hass, mp.DOMAIN,
                               {'media_player': {
                                   'platform': 'demo'
                               }})
        state = self.hass.states.get(entity_id)
        assert 1 == state.attributes.get('media_track')
        assert 0 == (mp.SUPPORT_PREVIOUS_TRACK
                     & state.attributes.get('supported_media_commands'))

        mp.media_next_track(self.hass, entity_id)
        self.hass.block_till_done()
        state = self.hass.states.get(entity_id)
        assert 2 == state.attributes.get('media_track')
        assert 0 < (mp.SUPPORT_PREVIOUS_TRACK
                    & state.attributes.get('supported_media_commands'))

        mp.media_next_track(self.hass, entity_id)
        self.hass.block_till_done()
        state = self.hass.states.get(entity_id)
        assert 3 == state.attributes.get('media_track')
        assert 0 < (mp.SUPPORT_PREVIOUS_TRACK
                    & state.attributes.get('supported_media_commands'))

        mp.media_previous_track(self.hass, entity_id)
        self.hass.block_till_done()
        state = self.hass.states.get(entity_id)
        assert 2 == state.attributes.get('media_track')
        assert 0 < (mp.SUPPORT_PREVIOUS_TRACK
                    & state.attributes.get('supported_media_commands'))

        assert setup_component(self.hass, mp.DOMAIN,
                               {'media_player': {
                                   'platform': 'demo'
                               }})
        ent_id = 'media_player.lounge_room'
        state = self.hass.states.get(ent_id)
        assert 1 == state.attributes.get('media_episode')
        assert 0 == (mp.SUPPORT_PREVIOUS_TRACK
                     & state.attributes.get('supported_media_commands'))

        mp.media_next_track(self.hass, ent_id)
        self.hass.block_till_done()
        state = self.hass.states.get(ent_id)
        assert 2 == state.attributes.get('media_episode')
        assert 0 < (mp.SUPPORT_PREVIOUS_TRACK
                    & state.attributes.get('supported_media_commands'))

        mp.media_previous_track(self.hass, ent_id)
        self.hass.block_till_done()
        state = self.hass.states.get(ent_id)
        assert 1 == state.attributes.get('media_episode')
        assert 0 == (mp.SUPPORT_PREVIOUS_TRACK
                     & state.attributes.get('supported_media_commands'))
    def test_prev_next_track(self):
        """Test media_next_track and media_previous_track ."""
        assert setup_component(
            self.hass, mp.DOMAIN,
            {'media_player': {'platform': 'demo'}})
        state = self.hass.states.get(entity_id)
        assert 1 == state.attributes.get('media_track')
        assert 0 == (mp.SUPPORT_PREVIOUS_TRACK &
                     state.attributes.get('supported_media_commands'))

        mp.media_next_track(self.hass, entity_id)
        self.hass.block_till_done()
        state = self.hass.states.get(entity_id)
        assert 2 == state.attributes.get('media_track')
        assert 0 < (mp.SUPPORT_PREVIOUS_TRACK &
                    state.attributes.get('supported_media_commands'))

        mp.media_next_track(self.hass, entity_id)
        self.hass.block_till_done()
        state = self.hass.states.get(entity_id)
        assert 3 == state.attributes.get('media_track')
        assert 0 < (mp.SUPPORT_PREVIOUS_TRACK &
                    state.attributes.get('supported_media_commands'))

        mp.media_previous_track(self.hass, entity_id)
        self.hass.block_till_done()
        state = self.hass.states.get(entity_id)
        assert 2 == state.attributes.get('media_track')
        assert 0 < (mp.SUPPORT_PREVIOUS_TRACK &
                    state.attributes.get('supported_media_commands'))

        assert setup_component(
            self.hass, mp.DOMAIN,
            {'media_player': {'platform': 'demo'}})
        ent_id = 'media_player.lounge_room'
        state = self.hass.states.get(ent_id)
        assert 1 == state.attributes.get('media_episode')
        assert 0 == (mp.SUPPORT_PREVIOUS_TRACK &
                     state.attributes.get('supported_media_commands'))

        mp.media_next_track(self.hass, ent_id)
        self.hass.block_till_done()
        state = self.hass.states.get(ent_id)
        assert 2 == state.attributes.get('media_episode')
        assert 0 < (mp.SUPPORT_PREVIOUS_TRACK &
                    state.attributes.get('supported_media_commands'))

        mp.media_previous_track(self.hass, ent_id)
        self.hass.block_till_done()
        state = self.hass.states.get(ent_id)
        assert 1 == state.attributes.get('media_episode')
        assert 0 == (mp.SUPPORT_PREVIOUS_TRACK &
                     state.attributes.get('supported_media_commands'))
Exemple #5
0
    def test_prev_next_track(self):
        assert mp.setup(self.hass, {"media_player": {"platform": "demo"}})
        state = self.hass.states.get(entity_id)
        assert 1 == state.attributes.get("media_track")
        assert 0 == (mp.SUPPORT_PREVIOUS_TRACK & state.attributes.get("supported_media_commands"))

        mp.media_next_track(self.hass, entity_id)
        self.hass.pool.block_till_done()
        state = self.hass.states.get(entity_id)
        assert 2 == state.attributes.get("media_track")
        assert 0 < (mp.SUPPORT_PREVIOUS_TRACK & state.attributes.get("supported_media_commands"))

        mp.media_next_track(self.hass, entity_id)
        self.hass.pool.block_till_done()
        state = self.hass.states.get(entity_id)
        assert 3 == state.attributes.get("media_track")
        assert 0 < (mp.SUPPORT_PREVIOUS_TRACK & state.attributes.get("supported_media_commands"))

        mp.media_previous_track(self.hass, entity_id)
        self.hass.pool.block_till_done()
        state = self.hass.states.get(entity_id)
        assert 2 == state.attributes.get("media_track")
        assert 0 < (mp.SUPPORT_PREVIOUS_TRACK & state.attributes.get("supported_media_commands"))