generated from personal-projects/leo-claude-mktplace
fix: resolve test failures and remove unavailable dependency
- Remove gitea-mcp-server from dependencies (not yet on PyPI) - Add starlette to dependencies (needed for middleware) - Fix HealthCheckBypassMiddleware to actually bypass auth via request.state flag - Fix test_required_fields to not require gitea_repo (optional for PMO mode) - Update pytest testpaths to correct location All 30 tests now pass. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -29,7 +29,9 @@ dependencies = [
|
|||||||
"pydantic>=2.0.0",
|
"pydantic>=2.0.0",
|
||||||
"pydantic-settings>=2.0.0",
|
"pydantic-settings>=2.0.0",
|
||||||
"python-dotenv>=1.0.0",
|
"python-dotenv>=1.0.0",
|
||||||
"gitea-mcp-server>=0.1.0",
|
"starlette>=0.36.0",
|
||||||
|
# gitea-mcp-server - installed separately (not on PyPI yet)
|
||||||
|
# See: https://gitea.hotserv.cloud/personal-projects/leo-claude-mktplace
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.optional-dependencies]
|
[project.optional-dependencies]
|
||||||
@@ -53,7 +55,7 @@ where = ["src"]
|
|||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
asyncio_mode = "auto"
|
asyncio_mode = "auto"
|
||||||
testpaths = ["tests"]
|
testpaths = ["src/gitea_http_wrapper/tests"]
|
||||||
python_files = ["test_*.py"]
|
python_files = ["test_*.py"]
|
||||||
python_classes = ["Test*"]
|
python_classes = ["Test*"]
|
||||||
python_functions = ["test_*"]
|
python_functions = ["test_*"]
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
# HTTP Transport Wrapper Dependencies
|
# HTTP Transport Wrapper Dependencies
|
||||||
mcp>=0.9.0
|
mcp>=0.9.0
|
||||||
uvicorn>=0.27.0
|
uvicorn>=0.27.0
|
||||||
|
starlette>=0.36.0
|
||||||
pydantic>=2.0.0
|
pydantic>=2.0.0
|
||||||
pydantic-settings>=2.0.0
|
pydantic-settings>=2.0.0
|
||||||
python-dotenv>=1.0.0
|
python-dotenv>=1.0.0
|
||||||
|
|
||||||
# Official Gitea MCP Server (to be wrapped)
|
# Official Gitea MCP Server (to be wrapped)
|
||||||
gitea-mcp-server>=0.1.0
|
# Install separately - not on PyPI yet
|
||||||
|
# See: https://gitea.hotserv.cloud/personal-projects/leo-claude-mktplace
|
||||||
|
|||||||
@@ -54,6 +54,10 @@ class BearerAuthMiddleware(BaseHTTPMiddleware):
|
|||||||
if not self.auth_enabled:
|
if not self.auth_enabled:
|
||||||
return await call_next(request)
|
return await call_next(request)
|
||||||
|
|
||||||
|
# Skip authentication if marked by HealthCheckBypassMiddleware
|
||||||
|
if getattr(request.state, "skip_auth", False):
|
||||||
|
return await call_next(request)
|
||||||
|
|
||||||
# Extract Authorization header
|
# Extract Authorization header
|
||||||
auth_header = request.headers.get("Authorization")
|
auth_header = request.headers.get("Authorization")
|
||||||
|
|
||||||
@@ -133,8 +137,8 @@ class HealthCheckBypassMiddleware(BaseHTTPMiddleware):
|
|||||||
# Check if request is for a health check endpoint
|
# Check if request is for a health check endpoint
|
||||||
if request.url.path in self.health_check_paths:
|
if request.url.path in self.health_check_paths:
|
||||||
logger.debug(f"Bypassing auth for health check: {request.url.path}")
|
logger.debug(f"Bypassing auth for health check: {request.url.path}")
|
||||||
# Skip remaining middleware chain for health checks
|
# Mark request to skip authentication in BearerAuthMiddleware
|
||||||
return await call_next(request)
|
request.state.skip_auth = True
|
||||||
|
|
||||||
# Not a health check, continue to next middleware
|
# Continue to next middleware
|
||||||
return await call_next(request)
|
return await call_next(request)
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ class TestGiteaSettings:
|
|||||||
GiteaSettings()
|
GiteaSettings()
|
||||||
|
|
||||||
errors = exc_info.value.errors()
|
errors = exc_info.value.errors()
|
||||||
required_fields = {"gitea_url", "gitea_token", "gitea_owner", "gitea_repo"}
|
# Note: gitea_repo is optional (for PMO mode)
|
||||||
|
required_fields = {"gitea_url", "gitea_token", "gitea_owner"}
|
||||||
error_fields = {error["loc"][0] for error in errors}
|
error_fields = {error["loc"][0] for error in errors}
|
||||||
assert required_fields.issubset(error_fields)
|
assert required_fields.issubset(error_fields)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user