Ejemplo n.º 1
0
 def test_download_playlist_if_playlist_is_downloaded(self, log_info):
     playlist = {'id': '1234', 'tracks': [{'name': 'some track'}]}
     playlist_data = {'checksum': playlists.checksum(playlist['tracks'])}
     playlists.cache.set('spotify_1234_mp3', playlist_data)
     playlists.download_playlist(playlist, 'spotify')
     log_info.assert_called_once_with(
         'Attempt to download an already downloaded playlist')
Ejemplo n.º 2
0
 def test_download_playlist_if_playlist_is_downloaded(self, log_info):
     playlist = {'id': '1234', 'tracks': [{'name': 'some track'}]}
     playlist_data = {'checksum': playlists.checksum(playlist['tracks'])}
     playlists.cache.set('spotify_1234_mp3', playlist_data)
     playlists.download_playlist(playlist, 'spotify')
     log_info.assert_called_once_with(
         'Attempt to download an already downloaded playlist')
Ejemplo n.º 3
0
 def test_download_playlist_with_missing_songs(self, chord, *args):
     playlist = {
         'id': '1234',
         'tracks': [{
             'name': 'some track'
         }, {
             'name': 'another track'
         }]
     }
     playlists.download_playlist(playlist, 'spotify')
     self.assertTrue(chord.called)
Ejemplo n.º 4
0
 def test_download_playlist_if_no_new_songs_need_to_be_downloaded(
         self, create_zip_playlist, *args):
     playlist = {
         'id': '1234',
         'tracks': [{
             'name': 'some track'
         }, {
             'name': 'another track'
         }]
     }
     playlists.download_playlist(playlist, 'spotify')
     self.assertTrue(create_zip_playlist.called)
Ejemplo n.º 5
0
 def test_download_playlist_with_missing_songs(self, chord, *args):
     playlist = {'id': '1234', 'tracks': [
         {'name': 'some track'}, {'name': 'another track'}]}
     playlists.download_playlist(playlist, 'spotify')
     self.assertTrue(chord.called)
Ejemplo n.º 6
0
 def test_download_playlist_if_no_new_songs_need_to_be_downloaded(
         self, create_zip_playlist, *args):
     playlist = {'id': '1234', 'tracks': [
         {'name': 'some track'}, {'name': 'another track'}]}
     playlists.download_playlist(playlist, 'spotify')
     self.assertTrue(create_zip_playlist.called)
Ejemplo n.º 7
0
 def test_download_playlist_if_playlist_is_downloading(self, log_info):
     playlist = {'id': '1234', 'tracks': [{'name': 'some track'}]}
     playlists.cache.set('spotify_1234_mp3', 'downloading')
     playlists.download_playlist(playlist, 'spotify')
     log_info.assert_called_once_with(
         'Attempt to download a playlist in the process of downloading')
Ejemplo n.º 8
0
 def test_download_playlist_in_unsupported_format(self):
     with self.assertRaisesRegex(ValueError, 'Format not supported: wav'):
         playlists.download_playlist(
             {'id': '1234'}, 'spotify', format='wav')
Ejemplo n.º 9
0
 def test_download_playlist_if_playlist_is_downloading(self, log_info):
     playlist = {'id': '1234', 'tracks': [{'name': 'some track'}]}
     playlists.cache.set('spotify_1234_mp3', 'downloading')
     playlists.download_playlist(playlist, 'spotify')
     log_info.assert_called_once_with(
         'Attempt to download a playlist in the process of downloading')
Ejemplo n.º 10
0
 def test_download_playlist_in_unsupported_format(self):
     with self.assertRaisesRegex(ValueError, 'Format not supported: wav'):
         playlists.download_playlist({'id': '1234'},
                                     'spotify',
                                     format='wav')