1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-09-19 19:01:03 +00:00

Reactivated config-dependent test

This commit is contained in:
spl0k 2017-11-27 22:46:09 +01:00
parent a62976ba9d
commit 9ffe40aa2c
2 changed files with 10 additions and 4 deletions

View File

@ -159,13 +159,13 @@ def cover_art():
size_path = os.path.join(app.config['WEBAPP']['cache_dir'], str(size))
path = os.path.abspath(os.path.join(size_path, str(res.id)))
if os.path.exists(path):
return send_file(path)
return send_file(path, mimetype = 'image/jpeg')
if not os.path.exists(size_path):
os.makedirs(size_path)
im.thumbnail([size, size], Image.ANTIALIAS)
im.save(path, 'JPEG')
return send_file(path)
return send_file(path, mimetype = 'image/jpeg')
@app.route('/rest/getLyrics.view', methods = [ 'GET', 'POST' ])
def lyrics():

View File

@ -102,7 +102,6 @@ class MediaTestCase(ApiTestBase):
self.assertEqual(im.format, 'JPEG')
self.assertEqual(im.size, (420, 420))
self.skipTest("config dependant test, config isn't test proof")
args['size'] = 120
rv = self.client.get('/rest/getCoverArt.view', query_string = args)
self.assertEqual(rv.status_code, 200)
@ -111,6 +110,14 @@ class MediaTestCase(ApiTestBase):
self.assertEqual(im.format, 'JPEG')
self.assertEqual(im.size, (120, 120))
# rerequest, just in case
rv = self.client.get('/rest/getCoverArt.view', query_string = args)
self.assertEqual(rv.status_code, 200)
self.assertEqual(rv.mimetype, 'image/jpeg')
im = Image.open(BytesIO(rv.data))
self.assertEqual(im.format, 'JPEG')
self.assertEqual(im.size, (120, 120))
# TODO test non square covers
def test_get_lyrics(self):
@ -129,7 +136,6 @@ class MediaTestCase(ApiTestBase):
# Local file
rv, child = self._make_request('getLyrics', { 'artist': 'artist', 'title': '23bytes' }, tag = 'lyrics')
self.assertIn('null', child.text)
print child
def test_get_avatar(self):
self._make_request('getAvatar', error = 0)