def lastfm_fav_to_spotify_playlist(): """Main method of the project that brings together other modules that are using APIs.""" (loved_tracks, spotify_username, playlist_name) = extract_variables() try: token = spotify.generate_token() except spotify.TokenGenerationException: print('Error generating token.') # GUI => dialog window else: sp = spotify.create_spotify_object(token) tracks_ids = spotify.create_spotify_tracks_ids_list_from_loved(loved_tracks, sp) playlist_id = spotify.create_playlist_for_user(sp, spotify_username, playlist_name) spotify.add_tracks_to_playlist(sp, spotify_username, playlist_id, tracks_ids)
def test_3_create_playlist_for_user(self): """Method testing if a playlist creation using Spotify API was successful.""" SpotifyTest.playlist_id = spotify.create_playlist_for_user(SpotifyTest.spotify_obj, properties.SPOTIFY_TEST_USERNAME, 'test') self.assertIsNotNone(SpotifyTest.playlist_id)
def test_3_create_playlist_for_user(self): """Method testing if a playlist creation using Spotify API was successful.""" SpotifyTest.playlist_id = spotify.create_playlist_for_user( SpotifyTest.spotify_obj, properties.SPOTIFY_TEST_USERNAME, 'test') self.assertIsNotNone(SpotifyTest.playlist_id)