Beispiel #1
0
    def test_repset_not_set(self, mock_coll, mock_repset, mock_load):
        """Function:  test_repset_not_set

        Description:  Test with repset name not set in config.

        Arguments:

        """

        mock_coll.return_value = self.coll
        mock_repset.return_value = self.repset
        mock_load.return_value = self.server2

        self.assertFalse(
            mongo_rep_admin.run_program(self.args_array, self.func_dict))
Beispiel #2
0
    def test_replication(self, mock_coll, mock_repset, mock_load):
        """Function:  test_replication

        Description:  Test with replication setup.

        Arguments:

        """

        mock_coll.return_value = self.coll
        mock_repset.return_value = self.repset
        mock_load.return_value = self.server

        self.assertFalse(
            mongo_rep_admin.run_program(self.args_array, self.func_dict))
Beispiel #3
0
    def test_successful_conn_coll(self, mock_coll, mock_repset, mock_load):
        """Function:  test_successful_conn_coll

        Description:  Test with successful connection.

        Arguments:

        """

        mock_coll.return_value = self.coll
        mock_repset.return_value = self.repset
        mock_load.return_value = self.server

        self.assertFalse(
            mongo_rep_admin.run_program(self.args_array, self.func_dict))
Beispiel #4
0
    def test_no_auth_mech(self, mock_coll, mock_repset, mock_load):
        """Function:  test_no_auth_mech

        Description:  Test with no auth_mech passed.

        Arguments:

        """

        mock_coll.return_value = self.coll
        mock_repset.return_value = self.repset
        mock_load.return_value = self.server

        self.assertFalse(
            mongo_rep_admin.run_program(self.args_array, self.func_dict))
Beispiel #5
0
    def test_func_no_error(self, mock_coll, mock_repset, mock_load):
        """Function:  test_func_no_error

        Description:  Test with no error returned from function call.

        Arguments:

        """

        mock_coll.return_value = self.coll
        mock_repset.return_value = self.repset
        mock_load.return_value = self.server3

        self.assertFalse(
            mongo_rep_admin.run_program(self.args_array, self.func_dict))
Beispiel #6
0
    def test_email(self, mock_coll, mock_repset, mock_load, mock_mail):
        """Function:  test_email

        Description:  Test with setting up email.

        Arguments:

        """

        mock_coll.return_value = self.coll
        mock_repset.return_value = self.repset
        mock_load.return_value = self.server
        mock_mail.return_value = "Mail Instance"

        self.assertFalse(
            mongo_rep_admin.run_program(self.args_array2, self.func_dict))
Beispiel #7
0
    def test_failed_conn_coll(self, mock_coll, mock_load):
        """Function:  test_failed_conn_coll

        Description:  Test with failed connection.

        Arguments:

        """

        self.coll.conn = False
        self.coll.errmsg = self.err_msg

        mock_coll.return_value = self.coll
        mock_load.return_value = self.server

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