1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-11-13 21:52:18 +00:00
supysonic/tests/issue133.py
ankitdobhal 8eca8ba60f
Fixed antipattern
- Remove unnecessary return statement
- Remove unnecessary `del` statement from local scope
- Consider merging the comparisons with 'in'
2021-02-21 11:29:43 +01:00

44 lines
1.1 KiB
Python

# 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 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()
scanner.queue_folder("folder")
scanner.run()
track = Track.select().first()
self.assertNotIn("\x00", track.title)
if __name__ == "__main__":
unittest.main()