def test_fail_src_dir(self): """Function: test_fail_src_dir Description: Test failure on missing source directory. Arguments: """ self.assertEqual( (gen_libs.cp_dir(self.cp_dir_dir, self.cp_dir_dir2)), (False, "Directory not copied. Exist Error Message: [Errno 2] " "No such file or directory: '%s'" % (self.cp_dir_dir)))
def test_cp_dir(self): """Function: test_cp_dir Description: Test copy of file in same directory. Arguments: """ os.makedirs(self.cp_dir_dir) self.assertEqual((gen_libs.cp_dir(self.cp_dir_dir, self.cp_dir_dir2)), (True, None))
def test_cp_dir_same(self): """Function: test_cp_dir_same Description: Test copy of directory to same name. Arguments: """ os.makedirs(self.cp_dir_dir) self.assertEqual( (gen_libs.cp_dir(self.cp_dir_dir, self.cp_dir_dir)), (False, "Directory not copied. Exist Error Message: [Errno 17] " "File exists: '%s'" % (self.cp_dir_dir)))
def test_fail_dest_perm(self): """Function: test_fail_dest_perm Description: Test failure on directory permission. Arguments: """ os.makedirs(self.cp_dir_dir) os.chmod(self.cp_dir_dir, 0000) self.assertEqual( (gen_libs.cp_dir(self.cp_dir_dir, self.cp_dir_dir2)), (False, "Directory not copied. Exist Error Message: [Errno 13] " "Permission denied: '%s'" % (self.cp_dir_dir)))
def test_fail_dest_dir(self): """Function: test_fail_dest_dir Description: Test failure on destination directory already exists. Arguments: """ os.makedirs(self.cp_dir_dir) os.makedirs(self.cp_dir_dir2) self.assertEqual( (gen_libs.cp_dir(self.cp_dir_dir, self.cp_dir_dir2)), (False, "Directory not copied. Exist Error Message: [Errno 17] " "File exists: '%s'" % (self.cp_dir_dir2)))