def test_play_media(self, mock_seek): """Test play_media .""" assert setup_component( self.hass, mp.DOMAIN, {'media_player': {'platform': 'demo'}}) ent_id = 'media_player.living_room' state = self.hass.states.get(ent_id) assert 0 < (mp.SUPPORT_PLAY_MEDIA & state.attributes.get('supported_media_commands')) assert state.attributes.get('media_content_id') is not None mp.play_media(self.hass, None, 'some_id', ent_id) self.hass.block_till_done() state = self.hass.states.get(ent_id) assert 0 < (mp.SUPPORT_PLAY_MEDIA & state.attributes.get('supported_media_commands')) assert not 'some_id' == state.attributes.get('media_content_id') mp.play_media(self.hass, 'youtube', 'some_id', ent_id) self.hass.block_till_done() state = self.hass.states.get(ent_id) assert 0 < (mp.SUPPORT_PLAY_MEDIA & state.attributes.get('supported_media_commands')) assert 'some_id' == state.attributes.get('media_content_id') assert not mock_seek.called mp.media_seek(self.hass, None, ent_id) self.hass.block_till_done() assert not mock_seek.called mp.media_seek(self.hass, 100, ent_id) self.hass.block_till_done() assert mock_seek.called
def test_play_media(self, mock_seek): """Test play_media .""" assert setup_component(self.hass, mp.DOMAIN, {'media_player': { 'platform': 'demo' }}) ent_id = 'media_player.living_room' state = self.hass.states.get(ent_id) assert 0 < (mp.SUPPORT_PLAY_MEDIA & state.attributes.get('supported_features')) assert state.attributes.get('media_content_id') is not None mp.play_media(self.hass, None, 'some_id', ent_id) self.hass.block_till_done() state = self.hass.states.get(ent_id) assert 0 < (mp.SUPPORT_PLAY_MEDIA & state.attributes.get('supported_features')) assert not 'some_id' == state.attributes.get('media_content_id') mp.play_media(self.hass, 'youtube', 'some_id', ent_id) self.hass.block_till_done() state = self.hass.states.get(ent_id) assert 0 < (mp.SUPPORT_PLAY_MEDIA & state.attributes.get('supported_features')) assert 'some_id' == state.attributes.get('media_content_id') assert not mock_seek.called mp.media_seek(self.hass, None, ent_id) self.hass.block_till_done() assert not mock_seek.called mp.media_seek(self.hass, 100, ent_id) self.hass.block_till_done() assert mock_seek.called
def test_play_media(self, mock_seek): assert mp.setup(self.hass, {"media_player": {"platform": "demo"}}) ent_id = "media_player.living_room" state = self.hass.states.get(ent_id) assert 0 < (mp.SUPPORT_PLAY_MEDIA & state.attributes.get("supported_media_commands")) assert state.attributes.get("media_content_id") is not None mp.play_media(self.hass, "youtube", "some_id", ent_id) self.hass.pool.block_till_done() state = self.hass.states.get(ent_id) assert 0 < (mp.SUPPORT_PLAY_MEDIA & state.attributes.get("supported_media_commands")) assert "some_id" == state.attributes.get("media_content_id") assert not mock_seek.called mp.media_seek(self.hass, 100, ent_id) self.hass.pool.block_till_done() assert mock_seek.called
def test_play_media(self, mock_seek): assert mp.setup(self.hass, {'media_player': {'platform': 'demo'}}) ent_id = 'media_player.living_room' state = self.hass.states.get(ent_id) assert 0 < (mp.SUPPORT_PLAY_MEDIA & state.attributes.get('supported_media_commands')) assert state.attributes.get('media_content_id') is not None mp.play_media(self.hass, 'youtube', 'some_id', ent_id) self.hass.pool.block_till_done() state = self.hass.states.get(ent_id) assert 0 < (mp.SUPPORT_PLAY_MEDIA & state.attributes.get('supported_media_commands')) assert 'some_id' == state.attributes.get('media_content_id') assert not mock_seek.called mp.media_seek(self.hass, 100, ent_id) self.hass.pool.block_till_done() assert mock_seek.called