[tests] add inbox stub test
This commit is contained in:
parent
5c01f24e91
commit
bf8142eb0b
1 changed files with 35 additions and 0 deletions
35
tests/test_inbox.py
Normal file
35
tests/test_inbox.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
#!/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
|
Loading…
Reference in a new issue