Example #1
0
    def test_fetch_priority(self, mock_coll):
        """Function:  test_fetch_priority

        Description:  Test fetch_priority function.

        Arguments:

        """

        mock_coll.return_value = self.coll

        with gen_libs.no_std_out():
            self.assertEqual(
                mongo_rep_admin.fetch_priority(self.server, self.args_array),
                self.status)
Example #2
0
    def test_empty_list(self, mock_coll):
        """Function:  test_empty_list

        Description:  Test return no members.

        Arguments:

        """

        self.coll.members["members"] = []

        mock_coll.return_value = self.coll

        with gen_libs.no_std_out():
            self.assertEqual(
                mongo_rep_admin.fetch_priority(self.server, self.args_array),
                self.status)
Example #3
0
    def test_failed_connection(self, mock_coll):
        """Function:  test_failed_connection

        Description:  Test with failed connection.

        Arguments:

        """

        self.coll.conn = False
        self.coll.errmsg = "Error Message"

        mock_coll.return_value = self.coll

        self.assertEqual(
            mongo_rep_admin.fetch_priority(self.server, self.args_array),
            self.status2)
Example #4
0
    def test_multiple_list(self, mock_coll):
        """Function:  test_multiple_list

        Description:  Test return multiple members.

        Arguments:

        """

        self.coll.members["members"].append({
            "host": "HostName2",
            "priority": 1
        })

        mock_coll.return_value = self.coll

        with gen_libs.no_std_out():
            self.assertEqual(
                mongo_rep_admin.fetch_priority(self.server, self.args_array),
                self.status)