~jamiebennett/entertainer/bug-372452-disable-screensaver

« back to all changes in this revision

Viewing changes to entertainerlib/tests/test_music.py

  • Committer: Matt Layman
  • Date: 2010-04-03 15:10:28 UTC
  • mfrom: (403.1.12 bye-feedz)
  • Revision ID: laymansterms.dev@gmail.com-20100403151028-fxbe7g64z129ohu6
All feed code is now removed. Lots of pylint cleanup too. (Matt Layman)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Copyright (c) 2009 Entertainer Developers - See COPYING - GPLv2
2
2
'''Tests Music'''
 
3
# pylint: disable-msg=W0212
3
4
 
4
5
import os
5
6
 
129
130
        bad_track = Track('', '', 1, '', 'foo-bar-baz**', 2, 3, '',
130
131
            self.music_library._create_album)
131
132
        try:
 
133
            # pylint: disable-msg=W0612
132
134
            album = bad_track.album
133
135
            self.fail()
134
136
        except AlbumHasNoTracks:
264
266
        self.music_library = MusicLibrary()
265
267
        self.album = self.music_library._create_album('album1')
266
268
 
267
 
    def testAlbumConstructor(self):
 
269
    def test_constructor(self):
268
270
        """Test that an Album object is properly constructed"""
269
271
        self.assertTrue(isinstance(self.album, Album))
270
272
        self.assertEqual(self.album.artist, 'artist0')
272
274
        self.assertEqual(self.album.title, 'album1')
273
275
        self.assertEqual(self.album.year, 0)
274
276
 
275
 
    def testAlbumConstructorNot(self):
 
277
    def test_constructor_not(self):
276
278
        """Test that an AlbumHasNoTracks exception is raised when the created
277
279
        album doesn't exist in the cache"""
278
280
        self.assertRaises(AlbumHasNoTracks, self.music_library._create_album,
279
281
            'foo')
280
282
 
281
 
    def testAlbumHasAlbumArt(self):
 
283
    def test_has_album_art(self):
282
284
        """Test that album art exists for the file"""
283
285
        album_artist = "artist0 - album1"
284
286
        album_artist = album_artist.encode("base64")
288
290
        if os.path.exists(album_art):
289
291
            os.remove(album_art)
290
292
 
291
 
    def testAlbumHasAlbumArtNot(self):
 
293
    def test_has_album_art_not(self):
292
294
        """Test that missing album art is reported back"""
293
295
        other_album = self.music_library._create_album('album1')
294
296
        self.assertFalse(other_album.has_album_art())
295
297
 
296
 
    def testAlbumGetAlbumArtUrl(self):
 
298
    def test_album_art_url(self):
297
299
        """Test that the path to the album's art is returned"""
298
300
        result = self.album.album_art_url
299
301
        album_artist = "artist0 - album1"
301
303
        album_art = os.path.join(self.art_path, album_artist + ".jpg")
302
304
        self.assertEqual(result, album_art)
303
305
 
304
 
    def testAlbumGetTracks(self):
 
306
    def test_tracks(self):
305
307
        """Test that all tracks for an album are returned"""
306
308
        result = self.album.tracks
307
309
        self.assertEqual(len(result), 4)