def get_all_songs(): skip = int(request.args.get('skip', 0)) count = int(request.args.get('count', 20)) songs_library = Songs(Songs.TEST_FILE) #return songs_library.get_songs(skip, count), {'Content-Type': 'application/json'} return jsonify(songs_library.get_songs(skip, count))
def test_get_songs(self): songs_library = Songs(Songs.TEST_FILE) songs = json.loads(songs_library.get_songs()) #check the count self.assertEqual(6, len(songs)) #check ordering self.assertEqual("Lycanthropic Metamorphosis", songs[0]['title']) self.assertEqual("The Yousicians", songs[0]['artist']) self.assertEqual("Wishing In The Night", songs[1]['title']) self.assertEqual("You've Got The Power", songs[2]['title']) self.assertEqual("Opa Opa Ta Bouzoukia", songs[3]['title']) self.assertEqual("Awaki-Waki", songs[4]['title']) self.assertEqual("Mr Fastfinger", songs[4]['artist']) self.assertEqual("A New Kennel", songs[5]['title'])