1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-09-20 11:21:03 +00:00
supysonic/tests/issue85.py

47 lines
1.2 KiB
Python
Raw Normal View History

2020-04-13 14:08:47 +00:00
# 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) 2020-2022 Alban 'spl0k' Féron
2020-04-13 14:08:47 +00:00
#
# Distributed under terms of the GNU AGPLv3 license.
import os
import os.path
import shutil
import sys
2020-04-13 14:08:47 +00:00
import tempfile
import unittest
from supysonic.db import init_database, release_database
from supysonic.managers.folder import FolderManager
from supysonic.scanner import Scanner
@unittest.skipIf(
sys.platform == "win32", "Windows doesn't seem too allow badly encoded paths"
)
2020-04-13 14:08:47 +00:00
class Issue85TestCase(unittest.TestCase):
def setUp(self):
self.__dir = tempfile.mkdtemp()
init_database("sqlite:")
2022-12-31 16:17:49 +00:00
FolderManager.add("folder", self.__dir)
2020-04-13 14:08:47 +00:00
def tearDown(self):
release_database()
shutil.rmtree(self.__dir)
def test_issue(self):
os.mkdir(os.path.join(self.__dir.encode(), b"\xe6"))
shutil.copyfile(
"tests/assets/folder/silence.mp3",
os.path.join(self.__dir.encode(), b"\xe6", b"silence.mp3"),
)
2022-12-31 16:17:49 +00:00
scanner = Scanner()
scanner.queue_folder("folder")
scanner.run()
2020-04-13 14:08:47 +00:00
if __name__ == "__main__":
unittest.main()