Compare commits

..

No commits in common. "10181aa01975bacffee1b2a6bd6871d52d06876a" and "1fe16c1342551bb46d27c1d2cdff5970ef30dc3b" have entirely different histories.

2 changed files with 1 additions and 41 deletions

View File

@ -132,18 +132,7 @@ async def context() -> JSONResponse:
)
]
pr_models = [
PullRequest(
id=p["id"],
number=p["number"],
title=p["title"],
state=p["state"],
user=(
p["user"].get("login", "")
if isinstance(p.get("user"), dict)
else ""
),
url=p["html_url"],
)
PullRequest(id=p["id"], number=p["number"], title=p["title"], state=p["state"], user=(p.get("user") or {}).get("login", ""), url=p["html_url"])
for p in (prs_data or [])[:50]
if isinstance(p, dict)
and all(

View File

@ -153,35 +153,6 @@ async def test_context_normalizes_nullable_pull_request_author(monkeypatch):
assert pull_request["user"] == ""
@pytest.mark.anyio
async def test_context_normalizes_malformed_pull_request_author(monkeypatch):
async def user():
return {"id": 1, "login": "timmy"}
async def empty_collection():
return []
async def pull_request_collection():
return [{
"id": 87,
"number": 87,
"title": "Malformed author",
"state": "open",
"user": "unknown",
"html_url": "https://forge.example/pulls/87",
}]
monkeypatch.setattr(main, "current_user", user)
monkeypatch.setattr(main, "repos", empty_collection)
monkeypatch.setattr(main, "issues", empty_collection)
monkeypatch.setattr(main, "pull_requests", pull_request_collection)
response = await main.context()
pull_request = json.loads(response.body)["pull_requests"][0]
assert pull_request["user"] == ""
@pytest.mark.anyio
async def test_context_normalizes_null_collection_payloads(monkeypatch):
async def user():