def test_get_loved_tracks_list(self): """Method testing get_loved_tracks method which retrives loved tracks for a given user and creates a list of dictionaries.""" user = lastfm.get_lastfm_user(properties.LASTFM_TEST_USERNAME, properties.LASTFM_TEST_PASSWORD) loved_tracks_list = lastfm.get_loved_tracks_list(user) expected_output = [{'artist': 'Freddy The Flying Dutchman & The Sistina Band', 'title': 'Wojtyla Disco Dance'}, {'artist': 'Desire', 'title': 'Under Your Spell'}] for output in expected_output: self.assertTrue(output in loved_tracks_list)
def test_get_loved_tracks_list(self): """Method testing get_loved_tracks method which retrives loved tracks for a given user and creates a list of dictionaries.""" user = lastfm.get_lastfm_user(properties.LASTFM_TEST_USERNAME, properties.LASTFM_TEST_PASSWORD) loved_tracks_list = lastfm.get_loved_tracks_list(user) expected_output = [{ 'artist': 'Freddy The Flying Dutchman & The Sistina Band', 'title': 'Wojtyla Disco Dance' }, { 'artist': 'Desire', 'title': 'Under Your Spell' }] for output in expected_output: self.assertTrue(output in loved_tracks_list)
def extract_variables(): """Method that extracts variables given as arguments when running the script and returns: - loved_tracks (list of dictionaries - read the doc of lastfm.get_loved_tracks_list method for further information) - spotify_username (given as argument) - playlist_name (given as argument) """ try: lastfm_user = lastfm.get_lastfm_user(sys.argv[1], sys.argv[2]) except lastfm.WrongCredentialsException: print('Wrong LastFM credentials.') # GUI => dialog window input('Press any key.') return loved_tracks = lastfm.get_loved_tracks_list(lastfm_user) spotify_username = sys.argv[3] playlist_name = sys.argv[4] return loved_tracks, spotify_username, playlist_name