Esempio n. 1
0
    def test_is_add_cmd_empty(self):

        """Function:  test_is_add_cmd_empty

        Description:  Test with empty dictionary.

        Arguments:

        """

        self.mongo.config["ssl"] = False
        cmd_line = mongo_libs.create_cmd(
            self.mongo, self.args_array, self.prog_name, self.path_opt,
            opt_arg={})

        self.assertEqual(cmd_line, self.cmd_result)
Esempio n. 2
0
    def test_add_cmd(self):

        """Function:  test_add_cmd

        Description:  Test with add_cmd call.

        Arguments:

        """

        self.mongo.config["ssl"] = False
        cmd_line = mongo_libs.create_cmd(
            self.mongo, self.args_array, self.prog_name, self.path_opt,
            req_arg=self.req_arg)

        self.assertEqual(cmd_line, self.cmd_result2)
Esempio n. 3
0
    def test_crt_base_cmd2(self):

        """Function:  test_crt_base_cmd2

        Description:  Test with combinations.

        Arguments:

        """

        self.mongo.config["ssl"] = False
        cmd_line = mongo_libs.create_cmd(
            self.mongo, self.args_array3, self.prog_name, self.path_opt,
            req_arg=self.req_arg, opt_arg=self.opt_arg2)

        self.assertEqual(cmd_line, self.cmd_result8)
Esempio n. 4
0
    def test_is_add_cmd_dict(self):

        """Function:  test_is_add_cmd_dict

        Description:  Test with multiple dictionary.

        Arguments:

        """

        self.mongo.config["ssl"] = False
        cmd_line = mongo_libs.create_cmd(
            self.mongo, self.args_array3, self.prog_name, self.path_opt,
            opt_arg=self.opt_arg2)

        self.assertEqual(cmd_line, self.cmd_result6)
Esempio n. 5
0
    def test_full_test(self):

        """Function:  test_full_test

        Description:  Test with all external calls.

        Arguments:

        """

        self.mongo.config["ssl"] = False
        cmd_line = mongo_libs.create_cmd(
            self.mongo, self.args_array3, self.prog_name, self.path_opt,
            req_arg=self.req_arg2, opt_arg=self.opt_arg2)

        self.assertEqual(cmd_line, self.cmd_result9)
Esempio n. 6
0
    def test_full_test(self):
        """Function:  test_full_test

        Description:  Test with all external calls.

        Arguments:

        """

        self.assertEqual(
            mongo_libs.create_cmd(self.mongo,
                                  self.args_array,
                                  self.prog_name,
                                  self.path_opt,
                                  opt_arg=self.opt_arg,
                                  req_arg=self.req_arg), self.result3)
Esempio n. 7
0
    def test_is_add_cmd(self, mock_arg, mock_cmd):
        """Function:  test_is_add_cmd

        Description:  Test with is_add_cmd call.

        Arguments:

        """

        mock_arg.return_value = self.path + "/"
        mock_cmd.return_value = [self.path + "/" + self.prog_name]
        self.assertEqual(
            mongo_libs.create_cmd(self.mongo,
                                  self.args_array,
                                  self.prog_name,
                                  self.path_opt,
                                  opt_arg=self.opt_arg), self.result)
Esempio n. 8
0
    def test_crt_base_cmd(self, mock_arg):
        """Function:  test_crt_base_cmd

        Description:  Test with crt_base_cmd call.

        Arguments:

        """

        mock_arg.return_value = self.path + "/"
        self.assertEqual(
            mongo_libs.create_cmd(self.mongo,
                                  self.args_array,
                                  self.prog_name,
                                  self.path_opt,
                                  opt_arg=self.opt_arg,
                                  req_arg=self.req_arg), self.result3)
Esempio n. 9
0
    def test_default(self, mock_arg, mock_cmd, mock_add, mock_is_add):
        """Function:  test_default

        Description:  Test with default settings.

        Arguments:

        """

        mock_arg.return_value = "Base_Program"
        mock_cmd.return_value = "Base_Crt_Program"
        mock_add.return_value = "Base_Crt_Program_Arg"
        mock_is_add.return_value = ["Base_Crt_Program_Arg_Plus"]
        self.assertEqual(
            mongo_libs.create_cmd(self.mongo,
                                  self.args_array,
                                  self.prog_name,
                                  self.path_opt,
                                  req_arg=self.req_arg),
            ["Base_Crt_Program_Arg_Plus"])