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

49 lines
1.2 KiB
Python
Raw Normal View History

# 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
2019-06-29 15:25:44 +00:00
class Issue139TestCase(unittest.TestCase):
def setUp(self):
self.__dir = tempfile.mkdtemp()
2019-06-29 15:25:44 +00:00
init_database("sqlite:")
with db_session:
2019-06-29 15:25:44 +00:00
FolderManager.add("folder", self.__dir)
def tearDown(self):
release_database()
shutil.rmtree(self.__dir)
@db_session
def do_scan(self):
scanner = Scanner()
2019-06-29 15:25:44 +00:00
scanner.queue_folder("folder")
2019-05-11 15:13:58 +00:00
scanner.run()
del scanner
def test_null_genre(self):
2019-06-29 15:25:44 +00:00
shutil.copy("tests/assets/issue139.mp3", self.__dir)
self.do_scan()
def test_float_bitrate(self):
2019-06-29 15:25:44 +00:00
shutil.copy("tests/assets/issue139.aac", self.__dir)
self.do_scan()
2019-06-29 15:25:44 +00:00
if __name__ == "__main__":
unittest.main()