コード例 #1
0
    def test_no_perf_list(self, mock_print):
        """Function:  test_no_perf_list

        Description:  Test with no perf_list passed.

        Arguments:

        """

        mock_print.return_value = (False, None)

        self.assertFalse(mysql_perf.mysql_stat_run(self.server))
コード例 #2
0
    def test_default(self, mock_print):
        """Function:  test_default

        Description:  Test with default settings.

        Arguments:

        """

        mock_print.return_value = (False, None)

        self.assertFalse(mysql_perf.mysql_stat_run(self.server))
コード例 #3
0
    def test_perf_empty_list(self, mock_print):
        """Function:  test_perf_empty_list

        Description:  Test with perf_list empty.

        Arguments:

        """

        mock_print.return_value = (False, None)

        self.assertFalse(
            mysql_perf.mysql_stat_run(self.server, perf_list=self.perf_list2))
コード例 #4
0
    def test_json_nostd(self):
        """Function:  test_json_nostd

        Description:  Test with JSON on and no standard out.

        Arguments:

        """

        self.assertFalse(
            mysql_perf.mysql_stat_run(self.server,
                                      self.perf_list,
                                      json_fmt=True,
                                      no_std=True))
コード例 #5
0
    def test_no_mongo_db_tbl(self, mock_print):
        """Function:  test_no_mongo_db_tbl

        Description:  Test with no db_tbl for mongo passed.

        Arguments:

        """

        mock_print.return_value = (False, None)

        self.assertFalse(
            mysql_perf.mysql_stat_run(self.server,
                                      perf_list=self.perf_list,
                                      class_cfg="Cfg"))
コード例 #6
0
    def test_no_mongo_cfg(self, mock_print):
        """Function:  test_no_mongo_cfg

        Description:  Test with no config for mongo passed.

        Arguments:

        """

        mock_print.return_value = (False, None)

        self.assertFalse(
            mysql_perf.mysql_stat_run(self.server,
                                      perf_list=self.perf_list,
                                      db_tbl=self.db_tbl))
コード例 #7
0
    def test_error_handling(self, mock_print):
        """Function:  test_error_handling

        Description:  Test error handling.

        Arguments:

        """

        mock_print.return_value = (True, "Error Message")

        with gen_libs.no_std_out():
            self.assertFalse(
                mysql_perf.mysql_stat_run(self.server,
                                          perf_list=self.perf_list))
コード例 #8
0
    def test_mail_json(self):
        """Function:  test_mail_json

        Description:  Test with email in JSON format.

        Arguments:

        """

        self.assertFalse(
            mysql_perf.mysql_stat_run(self.server,
                                      self.perf_list,
                                      json_fmt=False,
                                      mail=self.mail,
                                      no_std=True))
コード例 #9
0
    def test_json_std_out(self, mock_print):
        """Function:  test_json_nostd

        Description:  Test with JSON on and no standard out.

        Arguments:

        """

        mock_print.return_value = True

        self.assertFalse(
            mysql_perf.mysql_stat_run(self.server,
                                      self.perf_list,
                                      json_fmt=True,
                                      no_std=False))
コード例 #10
0
    def test_mongo(self, mock_print, mock_mongo):
        """Function:  test_mongo

        Description:  Test with mongo connection.

        Arguments:

        """

        mock_print.return_value = (False, None)
        mock_mongo.return_value = (True, None)

        self.assertFalse(
            mysql_perf.mysql_stat_run(self.server,
                                      db_tbl=self.db_tbl,
                                      perf_list=self.perf_list,
                                      class_cfg="Cfg"))
コード例 #11
0
    def test_json_file(self, mock_file):
        """Function:  test_json_file

        Description:  Test with JSON on and output to a file.

        Arguments:

        """

        mock_file.return_value = True

        self.assertFalse(
            mysql_perf.mysql_stat_run(self.server,
                                      self.perf_list,
                                      json_fmt=True,
                                      ofile=self.ofile,
                                      no_std=True))
コード例 #12
0
    def test_insert_fail(self, mock_print, mock_mongo):
        """Function:  test_insert_fail

        Description:  Test with failed insert into Mongo.

        Arguments:

        """

        mock_print.return_value = (False, None)
        mock_mongo.return_value = (False, "Connection Error")

        with gen_libs.no_std_out():
            self.assertFalse(
                mysql_perf.mysql_stat_run(self.server,
                                          db_tbl=self.db_tbl,
                                          perf_list=self.perf_list,
                                          class_cfg="Cfg"))