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

        Description:  Test with standard out being suppressed.

        Arguments:

        """

        self.assertFalse(mysql_db_admin.status(self.server, self.args_array))
Esempio n. 2
0
    def test_non_json(self):
        """Function:  test_non_json

        Description:  Test with in non-JSON format.

        Arguments:

        """

        with gen_libs.no_std_out():
            self.assertFalse(
                mysql_db_admin.status(self.server, self.args_array2))
Esempio n. 3
0
    def test_stdout(self):
        """Function:  test_stdout

        Description:  Test with standard out.

        Arguments:

        """

        with gen_libs.no_std_out():
            self.assertFalse(
                mysql_db_admin.status(self.server, self.args_array3))
Esempio n. 4
0
    def test_flatten_json(self, mock_write, mock_mongo):
        """Function:  test_flatten_json

        Description:  Test with flatten option for JSON format.

        Arguments:

        """

        mock_write.return_value = True
        mock_mongo.return_value = (True, None)

        self.assertFalse(mysql_db_admin.status(self.server, self.args_array5))
Esempio n. 5
0
    def test_mail_non_json(self):
        """Function:  test_mail_non_json

        Description:  Test with emailing out for non-json format.

        Arguments:

        """

        self.assertFalse(
            mysql_db_admin.status(self.server,
                                  self.args_array6,
                                  mail=self.mail))
Esempio n. 6
0
    def test_mail(self, mock_write, mock_mongo):
        """Function:  test_mail

        Description:  Test with emailing out.

        Arguments:

        """

        mock_write.return_value = True
        mock_mongo.return_value = (True, None)

        self.assertFalse(
            mysql_db_admin.status(self.server, self.args_array,
                                  mail=self.mail))
Esempio n. 7
0
    def test_file_non_json(self, mock_write):
        """Function:  test_file_non_json

        Description:  Test with writing to file for standard format.

        Arguments:

        """

        mock_write.return_value = True

        self.assertFalse(
            mysql_db_admin.status(self.server,
                                  self.args_array6,
                                  ofile="FileName"))
Esempio n. 8
0
    def test_append_to_file(self, mock_write, mock_mongo):
        """Function:  test_append_to_file

        Description:  Test with appending to file.

        Arguments:

        """

        mock_write.return_value = True
        mock_mongo.return_value = (True, None)

        self.assertFalse(
            mysql_db_admin.status(self.server,
                                  self.args_array4,
                                  ofile="FileName"))
Esempio n. 9
0
    def test_mongo(self, mock_write, mock_mongo):
        """Function:  test_mongo

        Description:  Test with mongo connection.

        Arguments:

        """

        mock_write.return_value = True
        mock_mongo.return_value = (True, None)

        self.assertFalse(
            mysql_db_admin.status(self.server,
                                  self.args_array,
                                  class_cfg="Cfg",
                                  db_tbl="db:tbl"))
Esempio n. 10
0
    def test_mongo_fail(self, mock_write, mock_mongo):
        """Function:  test_mongo_fail

        Description:  Test with mongo connection.

        Arguments:

        """

        mock_write.return_value = True
        mock_mongo.return_value = (False, "Error Message")

        with gen_libs.no_std_out():
            self.assertFalse(
                mysql_db_admin.status(self.server,
                                      self.args_array,
                                      class_cfg="Cfg",
                                      db_tbl="db:tbl"))