def test_attributes(self): pl = spotify.SearchPlaylist( self.session, name='foo', uri='uri:foo', image_uri='image:foo' ) self.assertEqual(pl.name, 'foo') self.assertEqual(pl.uri, 'uri:foo') self.assertEqual(pl.image_uri, 'image:foo')
def getitem(sp_search, key): return spotify.SearchPlaylist( name=utils.to_unicode( lib.sp_search_playlist_name(self._sp_search, key)), uri=utils.to_unicode( lib.sp_search_playlist_uri(self._sp_search, key)), image_uri=utils.to_unicode( lib.sp_search_playlist_image_uri(self._sp_search, key)))
def test_image(self, image_mock): image_mock.return_value = mock.sentinel.image pl = spotify.SearchPlaylist( name='foo', uri='uri:foo', image_uri='image:foo') result = pl.image self.assertEqual(result, mock.sentinel.image) image_mock.assert_called_with(pl.image_uri)
def test_playlist(self, playlist_mock): playlist_mock.return_value = mock.sentinel.playlist pl = spotify.SearchPlaylist( name='foo', uri='uri:foo', image_uri='image:foo') result = pl.playlist self.assertEqual(result, mock.sentinel.playlist) playlist_mock.assert_called_with(pl.uri)
def test_repr(self): pl = spotify.SearchPlaylist(self.session, name='foo', uri='uri:foo', image_uri='image:foo') result = repr(pl) self.assertEqual( result, 'SearchPlaylist(name=%r, uri=%r)' % ('foo', 'uri:foo'))
def test_image(self): self.session.get_image.return_value = mock.sentinel.image pl = spotify.SearchPlaylist( self.session, name='foo', uri='uri:foo', image_uri='image:foo' ) result = pl.image self.assertEqual(result, mock.sentinel.image) self.session.get_image.assert_called_with(pl.image_uri)