Ejemplo n.º 1
0
    def test_help_true(self, mock_arg, mock_help):
        """Function:  test_help_true

        Description:  Test help if returns true.

        Arguments:

        """

        mock_arg.arg_parse2.return_value = self.args_array
        mock_arg.arg_add_def.return_value = self.args_array
        mock_help.return_value = True

        self.assertFalse(mysql_perf.main())
Ejemplo n.º 2
0
    def test_arg_cond_false(self, mock_arg, mock_help, mock_req, mock_cond):
        """Function:  test_arg_cond_false

        Description:  Test arg_cond_req if returns false.

        Arguments:

        """

        mock_arg.arg_parse2.return_value = self.args_array
        mock_arg.arg_add_def.return_value = self.args_array
        mock_help.return_value = False
        mock_req.return_value = False
        mock_cond.return_value = False

        self.assertFalse(mysql_perf.main())
Ejemplo n.º 3
0
    def test_arg_file_true(self, mock_arg, mock_help):
        """Function:  test_arg_file_true

        Description:  Test arg_file_chk if returns true.

        Arguments:

        """

        mock_arg.arg_parse2.return_value = self.args_array
        mock_arg.arg_add_def.return_value = self.args_array
        mock_help.return_value = False
        mock_arg.arg_require.return_value = False
        mock_arg.arg_cond_req.return_value = True
        mock_arg.arg_dir_chk_crt.return_value = False
        mock_arg.arg_file_chk.return_value = True

        self.assertFalse(mysql_perf.main())
Ejemplo n.º 4
0
    def test_loop_negative(self, mock_arg, mock_help, mock_lock):
        """Function:  test_loop_negative

        Description:  Test with negative loop value.

        Arguments:

        """

        mock_arg.arg_parse2.return_value = self.args_array8
        mock_arg.arg_add_def.return_value = self.args_array8
        mock_help.return_value = False
        mock_arg.arg_require.return_value = False
        mock_arg.arg_cond_req.return_value = True
        mock_arg.arg_dir_chk_crt.return_value = False
        mock_arg.arg_file_chk.return_value = False
        mock_lock.return_value = self.proglock

        self.assertFalse(mysql_perf.main())
Ejemplo n.º 5
0
    def test_programlock_id(self, mock_arg, mock_help, mock_lock):
        """Function:  test_programlock_id

        Description:  Test ProgramLock with flavor ID.

        Arguments:

        """

        mock_arg.arg_parse2.return_value = self.args_array2
        mock_arg.arg_add_def.return_value = self.args_array2
        mock_help.return_value = False
        mock_arg.arg_require.return_value = False
        mock_arg.arg_cond_req.return_value = True
        mock_arg.arg_dir_chk_crt.return_value = False
        mock_arg.arg_file_chk.return_value = False
        mock_lock.return_value = self.proglock

        self.assertFalse(mysql_perf.main())
Ejemplo n.º 6
0
    def test_programlock_false(self, mock_arg, mock_help, mock_lock):
        """Function:  test_programlock_false

        Description:  Test with ProgramLock returns False.

        Arguments:

        """

        mock_arg.arg_parse2.return_value = self.args_array
        mock_arg.arg_add_def.return_value = self.args_array
        mock_help.return_value = False
        mock_arg.arg_require.return_value = False
        mock_arg.arg_cond_req.return_value = True
        mock_arg.arg_dir_chk_crt.return_value = False
        mock_arg.arg_file_chk.return_value = False
        mock_lock.side_effect = \
            mysql_perf.gen_class.SingleInstanceException

        with gen_libs.no_std_out():
            self.assertFalse(mysql_perf.main())