Пример #1
0
    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')
Пример #2
0
 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)))
Пример #3
0
    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)
Пример #4
0
    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)
Пример #5
0
    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'))
Пример #6
0
    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)