'Test play_media .'

@patch('homeassistant.components.media_player.demo.DemoYoutubePlayer.media_seek', autospec=True)
def test_play_media(self, mock_seek):

    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
