mirror of
https://github.com/spl0k/supysonic.git
synced 2024-12-22 17:06:17 +00:00
Reactivated config-dependent test
This commit is contained in:
parent
a62976ba9d
commit
9ffe40aa2c
@ -159,13 +159,13 @@ def cover_art():
|
|||||||
size_path = os.path.join(app.config['WEBAPP']['cache_dir'], str(size))
|
size_path = os.path.join(app.config['WEBAPP']['cache_dir'], str(size))
|
||||||
path = os.path.abspath(os.path.join(size_path, str(res.id)))
|
path = os.path.abspath(os.path.join(size_path, str(res.id)))
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
return send_file(path)
|
return send_file(path, mimetype = 'image/jpeg')
|
||||||
if not os.path.exists(size_path):
|
if not os.path.exists(size_path):
|
||||||
os.makedirs(size_path)
|
os.makedirs(size_path)
|
||||||
|
|
||||||
im.thumbnail([size, size], Image.ANTIALIAS)
|
im.thumbnail([size, size], Image.ANTIALIAS)
|
||||||
im.save(path, 'JPEG')
|
im.save(path, 'JPEG')
|
||||||
return send_file(path)
|
return send_file(path, mimetype = 'image/jpeg')
|
||||||
|
|
||||||
@app.route('/rest/getLyrics.view', methods = [ 'GET', 'POST' ])
|
@app.route('/rest/getLyrics.view', methods = [ 'GET', 'POST' ])
|
||||||
def lyrics():
|
def lyrics():
|
||||||
|
@ -102,7 +102,6 @@ class MediaTestCase(ApiTestBase):
|
|||||||
self.assertEqual(im.format, 'JPEG')
|
self.assertEqual(im.format, 'JPEG')
|
||||||
self.assertEqual(im.size, (420, 420))
|
self.assertEqual(im.size, (420, 420))
|
||||||
|
|
||||||
self.skipTest("config dependant test, config isn't test proof")
|
|
||||||
args['size'] = 120
|
args['size'] = 120
|
||||||
rv = self.client.get('/rest/getCoverArt.view', query_string = args)
|
rv = self.client.get('/rest/getCoverArt.view', query_string = args)
|
||||||
self.assertEqual(rv.status_code, 200)
|
self.assertEqual(rv.status_code, 200)
|
||||||
@ -111,6 +110,14 @@ class MediaTestCase(ApiTestBase):
|
|||||||
self.assertEqual(im.format, 'JPEG')
|
self.assertEqual(im.format, 'JPEG')
|
||||||
self.assertEqual(im.size, (120, 120))
|
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
|
# TODO test non square covers
|
||||||
|
|
||||||
def test_get_lyrics(self):
|
def test_get_lyrics(self):
|
||||||
@ -129,7 +136,6 @@ class MediaTestCase(ApiTestBase):
|
|||||||
# Local file
|
# Local file
|
||||||
rv, child = self._make_request('getLyrics', { 'artist': 'artist', 'title': '23bytes' }, tag = 'lyrics')
|
rv, child = self._make_request('getLyrics', { 'artist': 'artist', 'title': '23bytes' }, tag = 'lyrics')
|
||||||
self.assertIn('null', child.text)
|
self.assertIn('null', child.text)
|
||||||
print child
|
|
||||||
|
|
||||||
def test_get_avatar(self):
|
def test_get_avatar(self):
|
||||||
self._make_request('getAvatar', error = 0)
|
self._make_request('getAvatar', error = 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user