Ejemplo n.º 1
0
    def test_default(self, mock_conn, mock_db):

        """Function:  test_default

        Description:  Test with default arguments.

        Arguments:

        """

        mock_conn.return_value = True
        mock_db.return_value = self.mongo

        self.assertEqual(
            mongo_db_admin.process_request(self.server, self.func_name),
            (self.err_flag, self.err_msg))
Ejemplo n.º 2
0
    def test_tbl_list2(self, mock_conn, mock_db):

        """Function:  test_tbl_list2

        Description:  Test with partial table list.

        Arguments:

        """

        mock_conn.return_value = True
        mock_db.return_value = self.mongo

        self.assertEqual(
            mongo_db_admin.process_request(
                self.server, self.func_name, self.db_name, self.tbl_name2),
            (self.err_flag, self.err_msg))
Ejemplo n.º 3
0
    def test_tbl_list4(self, mock_conn, mock_db):

        """Function:  test_tbl_list4

        Description:  Test with no match table list.

        Arguments:

        """

        mock_conn.return_value = True
        mock_db.return_value = self.mongo

        with gen_libs.no_std_out():
            self.assertEqual(
                mongo_db_admin.process_request(
                    self.server, self.func_name, self.db_name, self.tbl_name4),
                (self.err_flag, self.err_msg))
Ejemplo n.º 4
0
    def test_connection_failure(self, mock_conn, mock_db):

        """Function:  test_connection_failure

        Description:  Test with failed connection.

        Arguments:

        """

        self.mongo.state = False
        self.mongo.errmsg = "Connection Error"

        mock_conn.return_value = True
        mock_db.return_value = self.mongo

        self.assertEqual(
            mongo_db_admin.process_request(self.server, self.func_name),
            (self.err_flag2, self.err_msg2))