1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-11-15 06:32:16 +00:00
supysonic/tests/issue148.py

44 lines
1.1 KiB
Python
Raw Normal View History

# This file is part of Supysonic.
# Supysonic is a Python implementation of the Subsonic server API.
#
2022-12-31 16:17:49 +00:00
# Copyright (C) 2019-2022 Alban 'spl0k' Féron
#
# Distributed under terms of the GNU AGPLv3 license.
import os.path
import shutil
import sys
import tempfile
import unittest
from supysonic.db import init_database, release_database
from supysonic.managers.folder import FolderManager
from supysonic.scanner import Scanner
2019-06-29 15:25:44 +00:00
@unittest.skipIf(sys.platform == "win32", "Windows doesn't allow space-only filenames")
class Issue148TestCase(unittest.TestCase):
def setUp(self):
self.__dir = tempfile.mkdtemp()
2019-06-29 15:25:44 +00:00
init_database("sqlite:")
2022-12-31 16:17:49 +00:00
FolderManager.add("folder", self.__dir)
def tearDown(self):
release_database()
shutil.rmtree(self.__dir)
def test_issue(self):
2019-06-29 15:25:44 +00:00
subdir = os.path.join(self.__dir, " ")
os.makedirs(subdir)
2019-06-29 15:25:44 +00:00
shutil.copyfile(
"tests/assets/folder/silence.mp3", os.path.join(subdir, "silence.mp3")
)
scanner = Scanner()
2019-06-29 15:25:44 +00:00
scanner.queue_folder("folder")
scanner.run()
2019-06-29 15:25:44 +00:00
if __name__ == "__main__":
unittest.main()