We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/IBM/mcp-context-forge'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
conftest.py•1.17 KiB
# -*- coding: utf-8 -*-
# Copyright (c) 2025 ContextForge Contributors.
# SPDX-License-Identifier: MIT
"""Shared fixtures for mcpgateway unit tests."""
from __future__ import annotations
from unittest.mock import AsyncMock, MagicMock
import pytest
class MockPermissionService:
"""Mock PermissionService that allows all permission checks by default."""
# Class-level mock that can be patched by individual tests
check_permission = AsyncMock(return_value=True)
def __init__(self, db=None):
self.db = db
@pytest.fixture(autouse=True)
def mock_permission_service(monkeypatch):
"""Auto-mock PermissionService to allow all permission checks.
This fixture is auto-used for all tests in this directory.
Tests that need to verify permission denial behavior should:
1. Set MockPermissionService.check_permission.return_value = False
2. Or configure side_effect for more complex scenarios
"""
# Reset the mock before each test to ensure clean state
MockPermissionService.check_permission = AsyncMock(return_value=True)
monkeypatch.setattr("mcpgateway.middleware.rbac.PermissionService", MockPermissionService)
return MockPermissionService