def test_prep_tree_for_archive(self): tasks = TarSCM.Tasks(self.cli) scm_base = Scm(self.cli, tasks) basedir = os.path.join(self.tmp_dir, self.__class__.__name__) dir1 = os.path.join(basedir, "test1") scm_base.clone_dir = basedir os.makedirs(dir1) with self.assertRaises(Exception) as ctx: scm_base.prep_tree_for_archive( "test2", basedir, "test1" ) self.assertRegexpMatches(ctx.exception.message, 'No such file or directory') scm_base.prep_tree_for_archive("test1", basedir, "test2") self.assertEqual(scm_base.arch_dir, os.path.join(basedir, "test2"))
def test_prep_tree_for_archive(self): tasks = TarSCM.Tasks(self.cli) scm_base = Scm(self.cli, tasks) basedir = os.path.join(self.tmp_dir, self.__class__.__name__) dir1 = os.path.join(basedir, "test1") scm_base.clone_dir = basedir os.makedirs(dir1) os.symlink('/', os.path.join(basedir, "test3")) with self.assertRaises(Exception) as ctx: scm_base.prep_tree_for_archive("test2", basedir, "test1") if (hasattr(ctx.exception, 'message')): msg = ctx.exception.message else: msg = ctx.exception self.assertRegexpMatches(str(msg), 'No such file or directory') scm_base.prep_tree_for_archive("test1", basedir, "test2") self.assertEqual(scm_base.arch_dir, os.path.join(basedir, "test2")) with self.assertRaises(SystemExit) as ctx: scm_base.prep_tree_for_archive("test3", basedir, "test2")
def test_prep_tree_for_archive(self): tasks = TarSCM.Tasks(self.cli) scm_base = Scm(self.cli, tasks) basedir = os.path.join(self.tmp_dir, self.__class__.__name__) dir1 = os.path.join(basedir, "test1") scm_base.clone_dir = basedir os.makedirs(dir1) os.symlink('/', os.path.join(basedir, "test3")) with self.assertRaises(Exception) as ctx: scm_base.prep_tree_for_archive( "test2", basedir, "test1" ) if (hasattr(ctx.exception, 'message')): msg = ctx.exception.message else: msg = ctx.exception self.assertRegexpMatches(str(msg), 'No such file or directory') scm_base.prep_tree_for_archive("test1", basedir, "test2") self.assertEqual(scm_base.arch_dir, os.path.join(basedir, "test2")) with self.assertRaises(SystemExit) as ctx: scm_base.prep_tree_for_archive("test3", basedir, "test2")