Exemplo n.º 1
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')

        common.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')

        common.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')

        common.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 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')

        common.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')

        common.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')
Exemplo n.º 2
0
    def test_prev_next_track(self):
        """Test media_next_track and media_previous_track ."""
        assert setup_component(self.opp, mp.DOMAIN,
                               {"media_player": {
                                   "platform": "demo"
                               }})
        state = self.opp.states.get(entity_id)
        assert 1 == state.attributes.get("media_track")

        common.media_next_track(self.opp, entity_id)
        self.opp.block_till_done()
        state = self.opp.states.get(entity_id)
        assert 2 == state.attributes.get("media_track")

        common.media_next_track(self.opp, entity_id)
        self.opp.block_till_done()
        state = self.opp.states.get(entity_id)
        assert 3 == state.attributes.get("media_track")

        common.media_previous_track(self.opp, entity_id)
        self.opp.block_till_done()
        state = self.opp.states.get(entity_id)
        assert 2 == state.attributes.get("media_track")

        assert setup_component(self.opp, mp.DOMAIN,
                               {"media_player": {
                                   "platform": "demo"
                               }})
        ent_id = "media_player.lounge_room"
        state = self.opp.states.get(ent_id)
        assert 1 == state.attributes.get("media_episode")

        common.media_next_track(self.opp, ent_id)
        self.opp.block_till_done()
        state = self.opp.states.get(ent_id)
        assert 2 == state.attributes.get("media_episode")

        common.media_previous_track(self.opp, ent_id)
        self.opp.block_till_done()
        state = self.opp.states.get(ent_id)
        assert 1 == state.attributes.get("media_episode")
Exemplo n.º 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')

        common.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')

        common.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')

        common.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 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')

        common.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')

        common.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')