chore: fix ruff lint (webhooks v2) + Windows-safe test teardown
FlowDeck CI / lint (push) Successful in 1m21s
FlowDeck CI / test (push) Failing after 10m1s
FlowDeck CI / docker (push) Skipped

This commit is contained in:
2026-09-21 21:58:47 -04:00
parent 2fceed0da2
commit b56b181c3e
5 changed files with 40 additions and 44 deletions
+1 -1
View File
@@ -16,7 +16,6 @@ from fastapi import APIRouter, Header, HTTPException, Request
from fastapi.responses import JSONResponse, Response from fastapi.responses import JSONResponse, Response
from app.db import get_conn from app.db import get_conn
from app.services.automations import fire_event as _fire_event
from app.services.api_v2_helpers import ( from app.services.api_v2_helpers import (
audit_log, audit_log,
check_idempotency, check_idempotency,
@@ -30,6 +29,7 @@ from app.services.api_v2_helpers import (
to_iso8601, to_iso8601,
validate_scopes_input, validate_scopes_input,
) )
from app.services.automations import fire_event as _fire_event
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
router = APIRouter(prefix="/api/v2", tags=["api-v2"]) router = APIRouter(prefix="/api/v2", tags=["api-v2"])
+3 -1
View File
@@ -30,7 +30,9 @@ def _user(request: Request, authorization: str | None = None,
try: try:
user = get_bearer_user(request, authorization) user = get_bearer_user(request, authorization)
except HTTPException: 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): if not has_scope(user.get("_token_scopes"), required_scope):
raise HTTPException( raise HTTPException(
status_code=403, status_code=403,
+4 -1
View File
@@ -42,7 +42,10 @@ def client():
yield TestClient(app) 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 ── # ── Core ──
+1 -10
View File
@@ -1,12 +1,7 @@
"""FlowDeck — v6.4.0 Webhooks v2 tests (HMAC, retries, +20 events).""" """FlowDeck — v6.4.0 Webhooks v2 tests (HMAC, retries, +20 events)."""
from __future__ import annotations from __future__ import annotations
import asyncio from unittest.mock import AsyncMock, MagicMock
import hashlib
import hmac
import json
import time
from unittest.mock import AsyncMock, MagicMock, patch
import httpx import httpx
import pytest import pytest
@@ -17,15 +12,11 @@ from app.services.webhook_outbound import (
RETRY_DELAYS, RETRY_DELAYS,
_deliver_once, _deliver_once,
_event_matches, _event_matches,
deliver_to_sub,
fire_event,
init_webhook_tables, init_webhook_tables,
retry_due_deliveries,
sign_payload, sign_payload,
verify_signature, verify_signature,
) )
# ── Fixtures ──────────────────────────────────────────────────────────────── # ── Fixtures ────────────────────────────────────────────────────────────────
@pytest.fixture @pytest.fixture