def test1(self): result = UtilsCommand.call("is_str_in_file", "success", self.fp.name) self.assertEqual(result.code, 0) with self.assertRaises(CommandError): try: UtilsCommand.call("is_str_in_file", "fail", self.fp.name) except CommandError as error: self.assertNotEqual(error.result.code, 0) self.assertEqual(error.result.stderr, "") raise
def test3(self): open(self.dir_path, "w") UtilsCommand.call("make_sure_dir_exists", self.dir_path) self.assertTrue(module.os.path.isdir(self.dir_path)) module.shutil.rmtree(self.dir_path)
def test1(self): self.assertFalse(module.os.path.exists(self.dir_path)) UtilsCommand.call("make_sure_dir_exists", self.dir_path) self.assertTrue(module.os.path.isdir(self.dir_path)) module.shutil.rmtree(self.dir_path)
def test2(self): with self.assertRaises(CommandError): UtilsCommand.call("is_line_in_file", "", self.fp.name)
def test3(self): module.os.mkdir(self.file_path) self.assertTrue(module.os.path.exists(self.file_path)) UtilsCommand.call("make_sure_not_exists", self.file_path) self.assertFalse(module.os.path.exists(self.file_path))
def test2(self): open(self.file_path, "w") self.assertTrue(module.os.path.exists(self.file_path)) UtilsCommand.call("make_sure_not_exists", self.file_path) self.assertFalse(module.os.path.exists(self.file_path))