Esempio n. 1
0
    def test_no_cfg(self, mock_mongo):
        """Function:  test_no_cfg

        Description:  Test with no configuration file.

        Arguments:

        """

        mock_mongo.return_value = self.server

        self.assertFalse(
            mongo_db_admin.run_program(self.args_array, self.func_dict))
Esempio n. 2
0
    def test_connection_successful(self, mock_mongo):
        """Function:  test_connection_successful

        Description:  Test with successful connection.

        Arguments:

        """

        mock_mongo.return_value = self.server

        self.assertFalse(
            mongo_db_admin.run_program(self.args_array, self.func_dict))
Esempio n. 3
0
    def test_cfg(self, mock_mongo, mock_load):
        """Function:  test_cfg

        Description:  Test with configuration file.

        Arguments:

        """

        mock_mongo.return_value = self.server
        mock_load.return_value = "RepConfig"

        self.assertFalse(
            mongo_db_admin.run_program(self.args_array2, self.func_dict))
Esempio n. 4
0
    def test_email(self, mock_mongo, mock_load, mock_mail):
        """Function:  test_email

        Description:  Test with email option.

        Arguments:

        """

        mock_mongo.return_value = self.server
        mock_load.return_value = "RepConfig"
        mock_mail.return_value = "EmailInstance"

        self.assertFalse(
            mongo_db_admin.run_program(self.args_array3, self.func_dict))
Esempio n. 5
0
    def test_func_failure(self, mock_mongo, mock_load):
        """Function:  test_func_failure

        Description:  Test with function returning error message.

        Arguments:

        """

        mock_mongo.return_value = self.server
        mock_load.return_value = "RepConfig"

        with gen_libs.no_std_out():
            self.assertFalse(
                mongo_db_admin.run_program(self.args_array2, self.func_dict2))
Esempio n. 6
0
    def test_connection_failure(self, mock_mongo):
        """Function:  test_connection_failure

        Description:  Test with failed connection.

        Arguments:

        """

        self.server.status = False
        self.server.errmsg = "Connection failure"
        mock_mongo.return_value = self.server

        with gen_libs.no_std_out():
            self.assertFalse(
                mongo_db_admin.run_program(self.args_array, self.func_dict))