chore: imports hoisten und stricter background-task assertion

This commit is contained in:
2026-05-04 22:40:22 +02:00
parent 4792f0277f
commit fab5569955

View File

@@ -1,5 +1,8 @@
from unittest.mock import AsyncMock
import pytest
from fastapi import HTTPException
from fastapi.testclient import TestClient
from pydantic import ValidationError
from app.webhook.models import NextcloudEvent, EventType
@@ -40,10 +43,6 @@ def test_verify_secret_missing_fail():
assert exc_info.value.status_code == 401
from unittest.mock import AsyncMock, MagicMock, patch
from fastapi.testclient import TestClient
def _make_app(monkeypatch):
"""Build the FastAPI app with all external clients stubbed."""
monkeypatch.setenv("NEXTCLOUD_WEBDAV_URL", "http://nc")
@@ -116,4 +115,7 @@ def test_webhook_dispatches_background_task(monkeypatch):
)
assert r.status_code == 202
process_mock.assert_awaited_once()
process_mock.assert_awaited_once_with(
"Documents/THB/Studium/2.Semester/Databases/x.pdf",
EventType.CREATED,
)