fix: normalize null activity feed payloads (#93)
This commit is contained in:
parent
43a2804562
commit
6e24d7db17
|
|
@ -47,6 +47,6 @@ async def activity_events() -> list[dict]:
|
|||
"repo": event.get("repo") or {},
|
||||
"created_at": event.get("created", ""),
|
||||
}
|
||||
for event in events
|
||||
for event in (events or [])
|
||||
if isinstance(event, dict)
|
||||
]
|
||||
|
|
|
|||
|
|
@ -148,3 +148,17 @@ async def test_activity_events_skips_malformed_feed_entries(monkeypatch):
|
|||
"repo": {"full_name": "stackchain/stackchain-dashboard"},
|
||||
"created_at": "2026-08-06T08:00:00Z",
|
||||
}]
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_activity_events_normalizes_null_feed_payload(monkeypatch):
|
||||
async def fake_current_user():
|
||||
return {"login": "timmy"}
|
||||
|
||||
async def fake_fetch(path):
|
||||
return None
|
||||
|
||||
monkeypatch.setattr(gitea_proxy, "current_user", fake_current_user)
|
||||
monkeypatch.setattr(gitea_proxy, "fetch", fake_fetch)
|
||||
|
||||
assert await gitea_proxy.activity_events() == []
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user