def test_match_create_dir(self): """Function: test_match_create_dir Description: Test with creating directory. Arguments: """ arg_parser.arg_dir_chk_crt(self.args_array2, self.dir_chk_list2, self.dir_crt_list2) self.assertTrue(os.path.isdir(self.path_dir1))
def test_chk_multiple_dirs(self): """Function: test_chk_multiple_dirs Description: Test with creating multiple directories. Arguments: """ arg_parser.arg_dir_chk_crt(self.args_array3, self.dir_chk_list3, self.dir_crt_list3) self.assertTrue(os.path.isdir(self.path_dir1)) self.assertTrue(os.path.isdir(self.path_dir2))
def test_empty_dir_chk_list(self): """Function: test_empty_dir_chk_list Description: Test with dir_chk_list is empty. Arguments: """ self.assertFalse( arg_parser.arg_dir_chk_crt(self.args_array2, self.dir_chk_list))
def test_no_match_between_sets(self): """Function: test_no_match_between_sets Description: Test with no match between arguments passed. Arguments: """ self.assertFalse( arg_parser.arg_dir_chk_crt(self.args_array2, self.dir_chk_list5))
def test_one_match_between_sets(self): """Function: test_one_match_between_sets Description: Test with one match between sets and is directory. Arguments: """ os.makedirs(self.path_dir1) self.assertFalse( arg_parser.arg_dir_chk_crt(self.args_array2, self.dir_chk_list2))
def test_match_no_dir(self): """Function: test_match_no_dir Description: Test with directory does not exist. Arguments: """ with gen_libs.no_std_out(): self.assertTrue( arg_parser.arg_dir_chk_crt(self.args_array2, self.dir_chk_list2))
def test_match_no_access(self, mock_os): """Function: test_match_no_access Description: Test with match between sets, but no access to directory. Arguments: """ mock_os.path.isdir.return_value = True mock_os.access.return_value = False self.assertTrue( arg_parser.arg_dir_chk_crt(self.args_array2, self.dir_chk_list2))
def test_match_create_dir_fail(self, mock_os): """Function: test_match_create_dir_fail Description: Test with failing to create directory. Arguments: """ mock_os.path.isdir.return_value = False mock_os.makedirs = raise_oserror with gen_libs.no_std_out(): self.assertTrue( arg_parser.arg_dir_chk_crt(self.args_array2, self.dir_chk_list2, self.dir_crt_list2))