def test_stdout_suppress_json(self):
        """Function:  test_stdout_suppress_json

        Description:  Test with standard out being suppressed.

        Arguments:

        """

        self.assertFalse(
            mysql_db_admin._process_json(self.args_array, self.outdata,
                                         self.mode))
    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._process_json(self.args_array2, self.outdata,
                                             self.mode))
    def test_stdout(self):
        """Function:  test_stdout

        Description:  Test with standard out.

        Arguments:

        """

        with gen_libs.no_std_out():
            self.assertFalse(
                mysql_db_admin._process_json(self.args_array3, self.outdata,
                                             self.mode))
    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._process_json(self.args_array5, self.outdata,
                                         self.mode))
    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._process_json(self.args_array4,
                                         self.outdata,
                                         self.mode,
                                         ofile="FileName"))
    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._process_json(self.args_array,
                                         self.outdata,
                                         self.mode,
                                         mail=self.mail))
    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._process_json(self.args_array,
                                         self.outdata,
                                         self.mode,
                                         class_cfg="Cfg",
                                         db_tbl="db:tbl"))
    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._process_json(self.args_array,
                                             self.outdata,
                                             self.mode,
                                             class_cfg="Cfg",
                                             db_tbl="db:tbl"))