feat: Restore bare-environment full-suite cache-policy test #1474
|
|
@ -6,6 +6,8 @@ from src import main
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
async def test_live_gitea_api_responses_cannot_be_stored_by_shared_caches(monkeypatch):
|
async def test_live_gitea_api_responses_cannot_be_stored_by_shared_caches(monkeypatch):
|
||||||
|
monkeypatch.setenv("STACKCHAIN_DASHBOARD_AUTH_MODE", "insecure-local")
|
||||||
|
|
||||||
async def user():
|
async def user():
|
||||||
return {"id": 1, "login": "timmy"}
|
return {"id": 1, "login": "timmy"}
|
||||||
|
|
||||||
|
|
@ -15,13 +17,17 @@ async def test_live_gitea_api_responses_cannot_be_stored_by_shared_caches(monkey
|
||||||
async def empty_events(user_data=None):
|
async def empty_events(user_data=None):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
async def empty_live_snapshot(**_revisions):
|
||||||
|
return main.JSONResponse({})
|
||||||
|
|
||||||
monkeypatch.setattr(main, "current_user", user)
|
monkeypatch.setattr(main, "current_user", user)
|
||||||
monkeypatch.setattr(main, "repos", empty_collection)
|
monkeypatch.setattr(main, "repos", empty_collection)
|
||||||
monkeypatch.setattr(main, "issues", empty_collection)
|
monkeypatch.setattr(main, "issues", empty_collection)
|
||||||
monkeypatch.setattr(main, "pull_requests", empty_collection)
|
monkeypatch.setattr(main, "pull_requests", empty_collection)
|
||||||
monkeypatch.setattr(main, "activity_events", empty_events)
|
monkeypatch.setattr(main, "activity_events", empty_events)
|
||||||
|
monkeypatch.setattr(main, "_live_snapshot_response", empty_live_snapshot)
|
||||||
|
|
||||||
transport = httpx.ASGITransport(app=main.app)
|
transport = httpx.ASGITransport(app=main.app, client=("127.0.0.1", 1234))
|
||||||
async with httpx.AsyncClient(transport=transport, base_url="http://test") as client:
|
async with httpx.AsyncClient(transport=transport, base_url="http://test") as client:
|
||||||
for path in ("/api/v1/context", "/api/v1/events", "/api/v1/live"):
|
for path in ("/api/v1/context", "/api/v1/events", "/api/v1/live"):
|
||||||
response = await client.get(path)
|
response = await client.get(path)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user