chore: imports hoisten und stricter background-task assertion
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
|
from unittest.mock import AsyncMock
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from fastapi import HTTPException
|
from fastapi import HTTPException
|
||||||
|
from fastapi.testclient import TestClient
|
||||||
from pydantic import ValidationError
|
from pydantic import ValidationError
|
||||||
|
|
||||||
from app.webhook.models import NextcloudEvent, EventType
|
from app.webhook.models import NextcloudEvent, EventType
|
||||||
@@ -40,10 +43,6 @@ def test_verify_secret_missing_fail():
|
|||||||
assert exc_info.value.status_code == 401
|
assert exc_info.value.status_code == 401
|
||||||
|
|
||||||
|
|
||||||
from unittest.mock import AsyncMock, MagicMock, patch
|
|
||||||
from fastapi.testclient import TestClient
|
|
||||||
|
|
||||||
|
|
||||||
def _make_app(monkeypatch):
|
def _make_app(monkeypatch):
|
||||||
"""Build the FastAPI app with all external clients stubbed."""
|
"""Build the FastAPI app with all external clients stubbed."""
|
||||||
monkeypatch.setenv("NEXTCLOUD_WEBDAV_URL", "http://nc")
|
monkeypatch.setenv("NEXTCLOUD_WEBDAV_URL", "http://nc")
|
||||||
@@ -116,4 +115,7 @@ def test_webhook_dispatches_background_task(monkeypatch):
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert r.status_code == 202
|
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,
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user