From fab55699550995824223d8945ac95739f021d61a Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Mon, 4 May 2026 22:40:22 +0200 Subject: [PATCH] chore: imports hoisten und stricter background-task assertion --- tests/test_webhook.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/test_webhook.py b/tests/test_webhook.py index f396b39..9e27190 100644 --- a/tests/test_webhook.py +++ b/tests/test_webhook.py @@ -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, + )