Ejemplo n.º 1
0
 def test_music(self):
     """
         Tests the music library.
     """
     albums = music.parse_music()
     self.assertTrue(albums)
     self.assertEquals(10, len(albums))
     self.assertTrue(albums[0]['title'])
     self.assertTrue(albums[0]['link'])
     self.assertTrue(albums[0]['date'])
Ejemplo n.º 2
0
def latest_music(request):
    """
        Returns JSON serialization of the latest music
    """
    albums = _fetch_from_redis(MUSIC_KEY)

    if not albums:
        albums = music.parse_music(json=True)
        _store_in_redis(albums, MUSIC_KEY)

    return HttpResponse(simplejson.dumps(albums))
Ejemplo n.º 3
0
 def test_music_json(self):
     """
         Tests the music library returning json format.
     """
     albums = music.parse_music(json=True)
     self.assertTrue(albums)
     albums = list(albums)
     self.assertEquals(10, len(albums))
     self.assertTrue(albums[0]['title'])
     self.assertTrue(albums[0]['link'])
     self.assertTrue(albums[0]['date'])