mirror of
https://github.com/spl0k/supysonic.git
synced 2024-12-22 17:06:17 +00:00
Added test case for #133
This commit is contained in:
parent
53d8660683
commit
d7bbbfe383
@ -3,7 +3,7 @@
|
|||||||
# This file is part of Supysonic.
|
# This file is part of Supysonic.
|
||||||
# Supysonic is a Python implementation of the Subsonic server API.
|
# Supysonic is a Python implementation of the Subsonic server API.
|
||||||
#
|
#
|
||||||
# Copyright (C) 2017-2018 Alban 'spl0k' Féron
|
# Copyright (C) 2017-2019 Alban 'spl0k' Féron
|
||||||
# 2017 Óscar García Amor
|
# 2017 Óscar García Amor
|
||||||
#
|
#
|
||||||
# Distributed under terms of the GNU AGPLv3 license.
|
# Distributed under terms of the GNU AGPLv3 license.
|
||||||
@ -17,6 +17,7 @@ from . import frontend
|
|||||||
|
|
||||||
from .issue101 import Issue101TestCase
|
from .issue101 import Issue101TestCase
|
||||||
from .issue129 import Issue129TestCase
|
from .issue129 import Issue129TestCase
|
||||||
|
from .issue133 import Issue133TestCase
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
suite = unittest.TestSuite()
|
suite = unittest.TestSuite()
|
||||||
@ -27,6 +28,7 @@ def suite():
|
|||||||
suite.addTest(frontend.suite())
|
suite.addTest(frontend.suite())
|
||||||
suite.addTest(unittest.makeSuite(Issue101TestCase))
|
suite.addTest(unittest.makeSuite(Issue101TestCase))
|
||||||
suite.addTest(unittest.makeSuite(Issue129TestCase))
|
suite.addTest(unittest.makeSuite(Issue129TestCase))
|
||||||
|
suite.addTest(unittest.makeSuite(Issue133TestCase))
|
||||||
|
|
||||||
return suite
|
return suite
|
||||||
|
|
||||||
|
BIN
tests/assets/issue133.flac
Normal file
BIN
tests/assets/issue133.flac
Normal file
Binary file not shown.
46
tests/issue133.py
Normal file
46
tests/issue133.py
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
#
|
||||||
|
# This file is part of Supysonic.
|
||||||
|
# Supysonic is a Python implementation of the Subsonic server API.
|
||||||
|
#
|
||||||
|
# Copyright (C) 2019 Alban 'spl0k' Féron
|
||||||
|
#
|
||||||
|
# Distributed under terms of the GNU AGPLv3 license.
|
||||||
|
|
||||||
|
import shutil
|
||||||
|
import tempfile
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from pony.orm import db_session
|
||||||
|
|
||||||
|
from supysonic.db import init_database, release_database
|
||||||
|
from supysonic.db import Folder, Track
|
||||||
|
from supysonic.managers.folder import FolderManager
|
||||||
|
from supysonic.scanner import Scanner
|
||||||
|
|
||||||
|
class Issue133TestCase(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.__dir = tempfile.mkdtemp()
|
||||||
|
shutil.copy('tests/assets/issue133.flac', self.__dir)
|
||||||
|
init_database('sqlite:')
|
||||||
|
with db_session:
|
||||||
|
FolderManager.add('folder', self.__dir)
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
release_database()
|
||||||
|
shutil.rmtree(self.__dir)
|
||||||
|
|
||||||
|
@db_session
|
||||||
|
def test_issue133(self):
|
||||||
|
scanner = Scanner()
|
||||||
|
folder = Folder.select(lambda f: f.root).first()
|
||||||
|
scanner.scan(folder)
|
||||||
|
scanner.finish()
|
||||||
|
del scanner
|
||||||
|
|
||||||
|
track = Track.select().first()
|
||||||
|
self.assertNotIn('\x00', track.title)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user