def test_fail_else(self): """Function: test_fail_else Description: Test failure for if statement else clause. Arguments: """ self.assertEqual((gen_libs.cp_file(self.src_file, self.cp_file_dir2, self.cp_file_dir, self.dest_file)), (False, "No such file or directory"))
def test_cp_file(self): """Function: test_cp_file Description: Test copy of file in same directory. Arguments: """ self.assertEqual((gen_libs.cp_file(self.src_file, self.cp_file_dir, self.cp_file_dir, self.dest_file)), (True, None))
def test_fail_dest_dir(self): """Function: test_fail_dest_dir Description: Test failure on missing destination directory. Arguments: """ self.assertEqual((gen_libs.cp_file(self.src_file, self.cp_file_dir, self.cp_file_dir2, self.dest_file)), (False, self.err_mask % (self.cp_file_dir2)))
def test_cp_file_diff(self): """Function: test_cp_file_diff Description: Test copy of file to different name. Arguments: """ self.assertEqual((gen_libs.cp_file(self.src_file, self.cp_file_dir, self.cp_file_dir, self.dest_file)), (True, None))
def test_fail_src_file(self): """Function: test_fail_src_file Description: Test failure on missing source file. Arguments: """ self.assertEqual((gen_libs.cp_file(self.dest_file, self.cp_file_dir, self.cp_file_dir, self.src_file)), (False, self.err_mask % (os.path.join(self.cp_file_dir, self.dest_file))))
def test_cp_file_same(self): """Function: test_cp_file_same Description: Test copy of file to same name. Arguments: """ gen_libs.touch(os.path.join(self.cp_file_dir2, "testme")) self.assertEqual((gen_libs.cp_file(self.src_file, self.cp_file_dir, self.cp_file_dir2)), (True, None))
def test_cp_file_dir(self): """Function: test_cp_file_dir Description: Test copy of file in different directory. Arguments: """ gen_libs.touch(os.path.join(self.cp_file_dir2, "testme")) self.assertEqual((gen_libs.cp_file(self.src_file, self.cp_file_dir, self.cp_file_dir2, self.dest_file)), (True, None))
def test_fail_dest_perm(self): """Function: test_fail_dest_perm Description: Test failure on directory permission. Arguments: """ gen_libs.touch(os.path.join(self.cp_file_dir2, self.src_file)) os.chmod(self.cp_file_dir2, 0444) self.assertEqual((gen_libs.cp_file(self.src_file, self.cp_file_dir, self.cp_file_dir2, self.dest_file)), (False, "Permission denied"))