Ejemplo n.º 1
0
    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))
Ejemplo n.º 2
0
    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))
Ejemplo n.º 3
0
    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))
Ejemplo n.º 4
0
    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))
Ejemplo n.º 5
0
    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))
Ejemplo n.º 6
0
    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))
Ejemplo n.º 7
0
    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))
Ejemplo n.º 8
0
    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))