Esempio n. 1
0
    def test_second_open_error(self):
        """Function:  test_second_open_error

        Description:  Test with second open but returns error.

        Arguments:

        """

        arg_parser.arg_file_chk(self.args_array, self.file_chk_list,
                                self.file_crt_list)
Esempio n. 2
0
    def test_second_open_no_error(self):
        """Function:  test_second_open_no_error

        Description:  Test with second open no error.

        Arguments:

        """

        arg_parser.arg_file_chk(self.args_array, self.file_chk_list,
                                self.file_crt_list)

        self.assertTrue(os.path.isfile(self.path_file))
Esempio n. 3
0
    def test_name_loop_one_item(self):
        """Function:  test_name_loop_one_item

        Description:  Test with name loop on one item.

        Arguments:

        """

        with gen_libs.no_std_out():
            arg_parser.arg_file_chk(self.args_array, self.file_chk_list)

        self.assertFalse(os.path.isfile(self.path_file))
Esempio n. 4
0
    def test_one_match_between_sets(self):
        """Function:  test_one_match_between_sets

        Description:  Test with one match between sets.

        Arguments:

        """

        with gen_libs.no_std_out():
            arg_parser.arg_file_chk(self.args_array, self.file_chk_list)

        self.assertFalse(os.path.isfile(self.path_file))
Esempio n. 5
0
    def test_isinstance_is_list(self):
        """Function:  test_isinstance_is_list

        Description:  Test with isinstance against a list.

        Arguments:

        """

        with gen_libs.no_std_out():
            arg_parser.arg_file_chk(self.args_array, self.file_chk_list)

        self.assertFalse(os.path.isfile(self.path_file))
Esempio n. 6
0
    def test_first_open_error_two(self):
        """Function:  test_first_open_error_two

        Description:  Test with first open and error 2 returned.

        Arguments:

        """

        arg_parser.arg_file_chk(self.args_array, self.file_chk_list,
                                self.file_crt_list)

        self.assertTrue(os.path.isfile(self.path_file))
Esempio n. 7
0
    def test_filecrtlist_not_passed(self):
        """Function:  test_filecrtlist_not_passed

        Description:  Test with file_crt_list not being passed.

        Arguments:

        """

        with gen_libs.no_std_out():
            arg_parser.arg_file_chk(self.args_array, self.file_chk_list)

        self.assertFalse(os.path.isfile(self.path_file))
Esempio n. 8
0
    def test_filecrtlist_empty_list(self):
        """Function:  test_filecrtlist_empty_list

        Description:  Test with file_crt_list passed with empty list.

        Arguments:

        """

        with gen_libs.no_std_out():
            arg_parser.arg_file_chk(self.args_array, self.file_chk_list, [])

        self.assertFalse(os.path.isfile(self.path_file))
Esempio n. 9
0
    def test_filecrtlist_in_list(self):
        """Function:  test_filecrtlist_in_list

        Description:  Test with file_crt_list with option in list.

        Arguments:

        """

        arg_parser.arg_file_chk(self.args_array, self.file_chk_list,
                                self.file_crt_list)

        self.assertTrue(os.path.isfile(self.path_file))
Esempio n. 10
0
    def test_first_open_no_errors(self):
        """Function:  test_first_open_no_errors

        Description:  Test with first open and no errors.

        Arguments:

        """

        fname = open(self.path_file, "w")
        fname.close()

        arg_parser.arg_file_chk(self.args_array, self.file_chk_list)

        self.assertTrue(os.path.isfile(self.path_file))
Esempio n. 11
0
    def test_two_match_between_sets(self):
        """Function:  test_two_match_between_sets

        Description:  Test with two matches between sets.

        Arguments:

        """

        self.file_chk_list = ["-f", "-g"]
        self.args_array = {"-f": self.path_file, "-g": "test2/file2"}

        with gen_libs.no_std_out():
            arg_parser.arg_file_chk(self.args_array, self.file_chk_list)

        self.assertFalse(os.path.isfile(self.path_file))
Esempio n. 12
0
    def test_filecrtlist_not_in_list(self):
        """Function:  test_filecrtlist_not_in_list

        Description:  Test with file_crt_list with option not in list.

        Arguments:

        """

        self.file_crt_list = ["-g"]

        with gen_libs.no_std_out():
            arg_parser.arg_file_chk(self.args_array, self.file_chk_list,
                                    self.file_crt_list)

        self.assertFalse(os.path.isfile(self.path_file))
Esempio n. 13
0
    def test_first_open_error_ten(self):
        """Function:  test_first_open_error_ten

        Description:  Test with first open and error 10 returned.

        Arguments:

        """

        self.assertTrue(
            arg_parser.arg_file_chk(self.args_array, self.file_chk_list))
Esempio n. 14
0
    def test_no_match_between_sets(self):
        """Function:  test_no_match_between_sets

        Description:  Test with no match between sets passed.

        Arguments:

        """

        self.file_chk_list = ["-a"]

        self.assertFalse(
            arg_parser.arg_file_chk(self.args_array, self.file_chk_list))
Esempio n. 15
0
    def test_one_match_between_sets(self, mock_open):
        """Function:  test_one_match_between_sets

        Description:  Test with one match between sets.

        Arguments:

        """

        mock_open.return_value = self.open

        self.assertFalse(
            arg_parser.arg_file_chk(self.args_array, self.file_chk_list))
Esempio n. 16
0
    def test_one_match_empty_list(self):
        """Function:  test_one_match_empty_list

        Description:  Test with one match between sets but empty list.

        Arguments:

        """

        self.args_array = {"-f": [], "-m": "Marker"}

        self.assertFalse(
            arg_parser.arg_file_chk(self.args_array, self.file_chk_list))
Esempio n. 17
0
    def test_isinstance_is_list(self, mock_open):
        """Function:  test_isinstance_is_list

        Description:  Test with isinstance against a list.

        Arguments:

        """

        mock_open.return_value = self.open

        self.assertFalse(
            arg_parser.arg_file_chk(self.args_array, self.file_chk_list))
Esempio n. 18
0
    def test_name_loop_one_item(self, mock_open):
        """Function:  test_name_loop_one_item

        Description:  Test with name loop on one item.

        Arguments:

        """

        mock_open.return_value = self.open

        self.assertFalse(
            arg_parser.arg_file_chk(self.args_array, self.file_chk_list))
Esempio n. 19
0
    def test_first_open_no_errors(self, mock_open):
        """Function:  test_first_open_no_errors

        Description:  Test with first open and no errors.

        Arguments:

        """

        mock_open.return_value = self.open

        self.assertFalse(
            arg_parser.arg_file_chk(self.args_array, self.file_chk_list))
Esempio n. 20
0
    def test_name_loop_zero_items(self):
        """Function:  test_name_loop_zero_items

        Description:  Test with name loop on zero items.

        Arguments:

        """

        self.args_array = {"-f": [], "-m": "Marker"}

        self.assertFalse(
            arg_parser.arg_file_chk(self.args_array, self.file_chk_list))
Esempio n. 21
0
    def test_filecrtlist_in_list(self, mock_open, mock_crt):
        """Function:  test_filecrtlist_in_list

        Description:  Test with file_crt_list with option in list.

        Arguments:

        """

        mock_open.side_effect = [self.open3, self.open]
        mock_crt.return_value = False

        self.assertFalse(
            arg_parser.arg_file_chk(self.args_array, self.file_chk_list,
                                    self.file_crt_list))
Esempio n. 22
0
    def test_isinstance_is_string(self, mock_open):
        """Function:  test_isinstance_is_string

        Description:  Test with isinstance against a string.

        Arguments:

        """

        mock_open.return_value = self.open

        self.args_array = {"-f": self.path_file, "-m": "Marker"}

        self.assertFalse(
            arg_parser.arg_file_chk(self.args_array, self.file_chk_list))
Esempio n. 23
0
    def test_first_open_error_two(self, mock_open, mock_crt):
        """Function:  test_first_open_error_two

        Description:  Test with first open and error 2 returned.

        Arguments:

        """

        mock_open.side_effect = [self.open3, self.open]
        mock_crt.return_value = False

        self.assertFalse(
            arg_parser.arg_file_chk(self.args_array, self.file_chk_list,
                                    self.file_crt_list))
Esempio n. 24
0
    def test_first_open_error_ten(self, mock_open, mock_crt):
        """Function:  test_first_open_error_ten

        Description:  Test with first open and error 10 returned.

        Arguments:

        """

        mock_open.return_value = self.open2
        mock_crt.return_value = True

        with gen_libs.no_std_out():
            self.assertTrue(
                arg_parser.arg_file_chk(self.args_array, self.file_chk_list))
Esempio n. 25
0
    def test_filecrtlist_not_passed(self, mock_open, mock_crt):
        """Function:  test_filecrtlist_not_passed

        Description:  Test with file_crt_list not being passed.

        Arguments:

        """

        mock_open.return_value = self.open3
        mock_crt.return_value = True

        with gen_libs.no_std_out():
            self.assertTrue(
                arg_parser.arg_file_chk(self.args_array, self.file_chk_list))
Esempio n. 26
0
    def test_second_open_no_error(self, mock_open, mock_crt):
        """Function:  test_second_open_no_error

        Description:  Test with second open no error.

        Arguments:

        """

        mock_open.side_effect = [self.open3, self.open]
        mock_crt.return_value = False

        self.assertFalse(
            arg_parser.arg_file_chk(self.args_array, self.file_chk_list,
                                    self.file_crt_list))
Esempio n. 27
0
    def test_two_match_between_sets(self, mock_open):
        """Function:  test_two_match_between_sets

        Description:  Test with two matches between sets.

        Arguments:

        """

        mock_open.return_value = self.open

        self.file_chk_list = ["-f", "-g"]
        self.args_array = {"-f": self.path_file, "-g": "test2/file2"}

        self.assertFalse(
            arg_parser.arg_file_chk(self.args_array, self.file_chk_list))
Esempio n. 28
0
    def test_filecrtlist_empty_list(self, mock_open, mock_crt):
        """Function:  test_filecrtlist_empty_list

        Description:  Test with file_crt_list passed with empty list.

        Arguments:

        """

        mock_open.return_value = self.open3
        mock_crt.return_value = True

        with gen_libs.no_std_out():
            self.assertTrue(
                arg_parser.arg_file_chk(self.args_array, self.file_chk_list,
                                        []))
Esempio n. 29
0
    def test_second_open_error(self, mock_open, mock_crt):
        """Function:  test_second_open_error

        Description:  Test with second open but returns error.

        Arguments:

        """

        mock_open.side_effect = [self.open3, self.open2]
        mock_crt.return_value = True

        with gen_libs.no_std_out():
            self.assertTrue(
                arg_parser.arg_file_chk(self.args_array, self.file_chk_list,
                                        self.file_crt_list))
Esempio n. 30
0
    def test_filecrtlist_not_in_list(self, mock_open, mock_crt):
        """Function:  test_filecrtlist_not_in_list

        Description:  Test with file_crt_list with option not in list.

        Arguments:

        """

        mock_open.return_value = self.open3
        mock_crt.return_value = True

        self.file_crt_list = ["-g"]

        with gen_libs.no_std_out():
            self.assertTrue(
                arg_parser.arg_file_chk(self.args_array, self.file_chk_list,
                                        self.file_crt_list))