def testComparatorWithMultipleFolders(self): current = os.path.join(self.folder, 'folder_tests_2') self.folderBrowser = MusicManager.FolderBrowser(db_files=[], folder=current) self.assertEqual( self.folderBrowser.getFolderFiles(), {"xml": ["test.xml", os.path.join("folder_2", "test2.xml")]})
def loadFolder(self, folder): self.folder = folder db = "sqlite:///{}/music.db".format(self.folder) self.manager = MusicManager.MusicManager(self, folder=self.folder, db=db) self.manager.setup() self.windows["main"].show() if not hasattr(self.windows["main"], "contentFrame"): self.windows["main"].load() self.windows["main"].themeSet = False
def testCleanup(self): manager = MusicManager.MusicManager(None, folder=os.getcwd()) result_set = manager.parseApiFiles(debug=True) self.file_list = manager.unzipApiFiles(result_set) dir = os.getcwd() extensions = ['xml'] for source in result_set: for file in result_set[source]: for ext in extensions: file_ext = file.split(".")[0] + "." + ext self.assertTrue(os.path.exists(os.path.join(dir, file_ext))) self.manager.cleanupApiFiles(result_set, extensions=extensions) for source in result_set: for file in result_set[source]: for ext in extensions: file_ext = file.split(".")[0] + "." + ext self.assertFalse( os.path.exists(os.path.join(dir, file_ext)))
def setUp(self): self.folder = os.path.join(os.path.dirname(ExtractMetadata.__file__), 'tests', 'test_files', 'unzip_tests') files = ['zip_test_1.mxl', 'zip_test_2.mxl'] self.unzipper = MusicManager.Unzipper(folder=self.folder, files=files)
def setUp(self): self.folder = os.path.join(os.path.dirname(ExtractMetadata.__file__), 'tests', 'test_files') self.current = os.path.join(self.folder, 'folder_tests') self.folderBrowser = MusicManager.FolderBrowser( db_files=['file1.xml', 'file2.xml'], folder=self.current)
def setUp(self): self.manager = MusicManager.MusicManager(None, folder=os.getcwd()) self.result_set = result_set self.file_list = manager.unzipApiFiles(self.result_set)
import unittest import os from implementation.primaries.ExtractMetadata.classes import MusicManager manager = MusicManager.MusicManager(None, folder=os.getcwd()) result_set = manager.parseApiFiles(debug=True) class TestMusicManagerWithApiIntegration(unittest.TestCase): """ tests which confirm functionality of API manager inside the musicmanager class separated from music manager tests because these take longer on a slow internet connection """ def setUp(self): self.manager = MusicManager.MusicManager(None, folder=os.getcwd()) self.result_set = result_set self.file_list = manager.unzipApiFiles(self.result_set) def testUnzipData(self): dir = os.getcwd() for source in self.file_list: for file in self.file_list[source]: self.assertTrue(os.path.exists(os.path.join(dir, file))) def testParseData(self): self.assertTrue(len(self.result_set) > 0) for source in self.result_set: comp = { fname: self.result_set[source][fname] for fname in self.result_set[source] if "source" in self.result_set[source][fname]