chore: fix ruff lint (webhooks v2) + Windows-safe test teardown
This commit is contained in:
@@ -16,7 +16,6 @@ from fastapi import APIRouter, Header, HTTPException, Request
|
||||
from fastapi.responses import JSONResponse, Response
|
||||
|
||||
from app.db import get_conn
|
||||
from app.services.automations import fire_event as _fire_event
|
||||
from app.services.api_v2_helpers import (
|
||||
audit_log,
|
||||
check_idempotency,
|
||||
@@ -30,6 +29,7 @@ from app.services.api_v2_helpers import (
|
||||
to_iso8601,
|
||||
validate_scopes_input,
|
||||
)
|
||||
from app.services.automations import fire_event as _fire_event
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
router = APIRouter(prefix="/api/v2", tags=["api-v2"])
|
||||
|
||||
+3
-1
@@ -30,7 +30,9 @@ def _user(request: Request, authorization: str | None = None,
|
||||
try:
|
||||
user = get_bearer_user(request, authorization)
|
||||
except HTTPException:
|
||||
raise HTTPException(status_code=401, detail="Invalid or expired API token")
|
||||
raise HTTPException(
|
||||
status_code=401, detail="Invalid or expired API token"
|
||||
) from None
|
||||
if not has_scope(user.get("_token_scopes"), required_scope):
|
||||
raise HTTPException(
|
||||
status_code=403,
|
||||
|
||||
+4
-1
@@ -42,7 +42,10 @@ def client():
|
||||
|
||||
yield TestClient(app)
|
||||
|
||||
os.unlink(db_path)
|
||||
try:
|
||||
os.unlink(db_path)
|
||||
except PermissionError:
|
||||
pass # Windows: file may still be open in another thread
|
||||
|
||||
|
||||
# ── Core ──
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
"""FlowDeck — v6.4.0 Webhooks v2 tests (HMAC, retries, +20 events)."""
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import hashlib
|
||||
import hmac
|
||||
import json
|
||||
import time
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
from unittest.mock import AsyncMock, MagicMock
|
||||
|
||||
import httpx
|
||||
import pytest
|
||||
@@ -17,15 +12,11 @@ from app.services.webhook_outbound import (
|
||||
RETRY_DELAYS,
|
||||
_deliver_once,
|
||||
_event_matches,
|
||||
deliver_to_sub,
|
||||
fire_event,
|
||||
init_webhook_tables,
|
||||
retry_due_deliveries,
|
||||
sign_payload,
|
||||
verify_signature,
|
||||
)
|
||||
|
||||
|
||||
# ── Fixtures ────────────────────────────────────────────────────────────────
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
Reference in New Issue
Block a user