def test_move_media_exist(self, l): shutil.copy('./tests/library/2 Guns.avi', './tests/library/abc.avi') cleaner.create_dir('./tests/library/2 Guns (2009)') self.assertTrue(os.path.isdir('./tests/library/2 Guns (2009)')) moved = cleaner.move_media('./tests/library/abc.avi', './tests/library/2 Guns (2009)/2 Guns.avi') self.assertTrue(moved) self.assertIn('already exist', str(l))
def test_create_bad_perm(self): cleaner.create_dir('./tests/library/test_directory_perm') self.assertTrue(os.path.isdir('./tests/library/test_directory_perm')) os.chmod('./tests/library/test_directory_perm', 400) with self.assertRaises(PlexCleanerException) as e: cleaner.create_dir('./tests/library/test_directory_perm/bad') self.assertTrue('Unable to create' in e.exception.message)
def test_copy_jacket(self): cleaner.create_dir('./tests/library/2 Guns (2009)') self.assertTrue(os.path.isdir('./tests/library/2 Guns (2009)')) cleaner.copy_jacket( './tests/posters/com.plexapp.agents.themoviedb_1a3b1b98c2799d759e110285001f536982cdb869', './tests/library/2 Guns (2009)/poster.jpg', False) self.assertTrue( os.path.exists('./tests/library/2 Guns (2009)/poster.jpg'))
def test_move_media(self): shutil.copy('./tests/library/2 Guns.avi', './tests/library/abc.avi') cleaner.create_dir('./tests/library/2 Guns (2009)') self.assertTrue(os.path.isdir('./tests/library/2 Guns (2009)')) moved = cleaner.move_media('./tests/library/abc.avi', './tests/library/2 Guns (2009)/2 Guns.avi') self.assertTrue( os.path.exists('./tests/library/2 Guns (2009)/2 Guns.avi')) self.assertTrue(moved)
def test_create_dir_exist(self, l): cleaner.create_dir('./tests/library/test_directory_exist') self.assertTrue(os.path.isdir('./tests/library/test_directory_exist')) cleaner.create_dir('./tests/library/test_directory_exist') self.assertIn('already exist', str(l))
def test_create_dir(self): cleaner.create_dir('./tests/library/test_directory') self.assertTrue(os.path.isdir('./tests/library/test_directory'))