35 lines
806 B
Python
35 lines
806 B
Python
#!/usr/bin/env python3
|
|
import pytest
|
|
import fastapi
|
|
import respx
|
|
from app.main import app
|
|
from app.utils import precheck
|
|
from fastapi.testclient import TestClient
|
|
from sqlalchemy.orm import Session
|
|
from app import activitypub as ap, httpsig
|
|
from app.config import AP_CONTENT_TYPE
|
|
|
|
|
|
|
|
def test_inbox_announce_request(
|
|
db: Session,
|
|
client: TestClient,
|
|
respx_mock: respx.MockRouter,
|
|
) -> None:
|
|
|
|
async def inbox_prechecker(
|
|
request: fastapi.Request,
|
|
) -> bool:
|
|
return True
|
|
|
|
app.dependency_overrides[precheck.inbox_prechecker] = inbox_prechecker
|
|
|
|
response = client.post(
|
|
"/inbox",
|
|
headers={"Content-Type": AP_CONTENT_TYPE},
|
|
json={"stub": 1},
|
|
)
|
|
|
|
print(response.headers)
|
|
print(response.content)
|
|
assert response.status_code == 200
|