Ejemplo n.º 1
0
 def test_getFilesToMigrateReturnsFilesFromSubfolders(self):
     path = ".\\test\\1\\"
     pwd = os.path.abspath(os.path.curdir)
     expectedOutput = [
         os.path.join(pwd, "test\\1\\season 1\\episodes\\s01e01.mkv")
     ]
     self.assertEqual(FlattenUtils.getFilesToMigrate(path, [".mkv"]),
                      expectedOutput)
Ejemplo n.º 2
0
 def test_getFoldersGetsAllFolders(self):
     path = "test\\"
     pwd = os.path.abspath(os.path.curdir)
     expectedOutput = [
         os.path.join(pwd, "test\\1\\season 1\\episodes"),
         os.path.join(pwd, "test\\1"),
         os.path.join(pwd, "test\\2"),
     ]
     self.assertEqual(
         FlattenUtils.getFoldersWithVideoFiles(os.path.join(pwd, path),
                                               [".mkv", ".mp4"]),
         expectedOutput)
Ejemplo n.º 3
0
 def test_getFilesToMigrateReturnsAllFilesWhenProvidedPath(self):
     path = ".\\test\\"
     pwd = os.path.abspath(os.path.curdir)
     expectedOutput = [
         os.path.join(pwd, "test\\1\\season 1\\episodes\\s01e01.mkv"),
         os.path.join(pwd, "test\\1\\herewego.mp4"),
         os.path.join(pwd, "test\\1\\movie.txt"),
         os.path.join(pwd, "test\\2\\movie.mkv")
     ]
     self.assertEqual(
         FlattenUtils.getFilesToMigrate(path, ['.mp4', '.mkv', '.txt']),
         expectedOutput)
Ejemplo n.º 4
0
 def test_getFilesToMigrateThrowsExceptionIfNoPathProvided(self):
     with self.assertRaises(Exception):
         FlattenUtils.getFilesToMigrate("", [])
Ejemplo n.º 5
0
 def test_getFilesToMigrateReturnsOnlyMP4WhenProvidedPathAndMP4Filter(self):
     path = ".\\test\\1\\"
     pwd = os.path.abspath(os.path.curdir)
     expectedOutput = [os.path.join(pwd, "test\\1\\herewego.mp4")]
     self.assertEqual(FlattenUtils.getFilesToMigrate(path, [".mp4"]),
                      expectedOutput)
Ejemplo n.º 6
0
 def test_getFilesToMigrateThrowsExceptionIfFileNotFolderIsProvided(self):
     with self.assertRaises(Exception):
         FlattenUtils.getFilesToMigrate(".\\test\\1\\herewego.mp4", [])
Ejemplo n.º 7
0
 def test_getFilesToMigrateThrowsExceptionIfInvalidFolderProvided(self):
     with self.assertRaises(Exception):
         FlattenUtils.getFilesToMigrate(
             "c:\\lkihaghdklhdghklagdklhadgklhakjlgjkladg", [])