1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-12-22 17:06:17 +00:00

Added test case for embeded album art

This commit is contained in:
Taizo Simpson 2018-10-08 15:30:38 -04:00
parent 9ab6af1ae6
commit 29e462e0b8
No known key found for this signature in database
GPG Key ID: D197B1197B2D4D68
2 changed files with 30 additions and 0 deletions

View File

@ -32,6 +32,13 @@ class MediaTestCase(ApiTestBase):
)
self.folderid = folder.id
folder_embeded_art = Folder(
name = 'Root',
path = os.path.abspath('tests/assets/folder'),
root = True,
)
self.folderid_embeded = folder_embeded_art.id
artist = Artist(name = 'Artist')
album = Album(artist = artist, name = 'Album')
@ -50,6 +57,20 @@ class MediaTestCase(ApiTestBase):
last_modification = 0
)
self.trackid = track.id
track_embeded_art = Track(
title = '[silence]',
number = 1,
disc = 1,
artist = artist,
album = album,
path = os.path.abspath('tests/assets/folder/silence.mp3'),
root_folder = folder_embeded_art,
folder = folder_embeded_art,
duration = 2,
bitrate = 320,
content_type = 'audio/mpeg',
last_modification = 0
)
def test_stream(self):
self._make_request('stream', error = 10)
@ -121,6 +142,15 @@ class MediaTestCase(ApiTestBase):
# TODO test non square covers
# Test extracting cover art from embeded media
args['id'] = str(self.folderid_embeded)
rv = self.client.get('/rest/getCoverArt.view', query_string = args)
self.assertEqual(rv.status_code, 200)
self.assertEqual(rv.mimetype, 'image/png')
im = Image.open(BytesIO(rv.data))
self.assertEqual(im.format, 'PNG')
self.assertEqual(im.size, (120, 120))
def test_get_lyrics(self):
self._make_request('getLyrics', error = 10)
self._make_request('getLyrics', { 'artist': 'artist' }, error = 10)

Binary file not shown.