diff --git a/tests/factories.py b/tests/factories.py index aacae64..17b5e36 100644 --- a/tests/factories.py +++ b/tests/factories.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import factory +import fastapi import app.activitypub as ap from app import models @@ -61,3 +62,10 @@ class ActorFactory(factory.alchemy.SQLAlchemyModelFactory): ap_type = "Person" ap_id = "stub" + + + +async def inbox_prechecker( + request: fastapi.Request, +) -> bool: + return True diff --git a/tests/test_inbox.py b/tests/test_inbox.py index ffe18f6..648cc3c 100644 --- a/tests/test_inbox.py +++ b/tests/test_inbox.py @@ -4,7 +4,7 @@ import fastapi import respx import httpx from uuid import uuid4 -from tests import factories # type: ignore +from tests import factories from unittest import mock from app.main import app @@ -24,11 +24,6 @@ def test_inbox_follow_request( respx_mock: respx.MockRouter, ) -> None: - async def inbox_prechecker( - request: fastapi.Request, - ) -> bool: - return True - # build test actor ra = factories.RemoteActorFactory( base_url="https://example.com", @@ -37,7 +32,7 @@ def test_inbox_follow_request( ) ap_id = ra.ap_id # type: ignore - app.dependency_overrides[precheck.inbox_prechecker] = inbox_prechecker + app.dependency_overrides[precheck.inbox_prechecker] = factories.inbox_prechecker # mock request respx_mock.get(ap_id).mock(return_value=httpx.Response(200,json=ra.ap_actor))