fix: normalize nullable pull request authors (#56)
CI / lint (pull_request) Successful in 9s
CI / build-frontend (pull_request) Successful in 4s

This commit is contained in:
timmy committed 2026-08-06 00:47:54 +00:00
1 parent 6678358e4c
commit a92109b65f
2 files changed
+31 -2

No files matched your search

+30 -1
View File
@@ -90,4 +90,33 @@ async def test_context_normalizes_nullable_repository_description(monkeypatch):
response = await main.context()
repository = json.loads(response.body)["repos"][0]
assert repository["description"] == ""
assert repository["description"] == ""
@pytest.mark.anyio
async def test_context_normalizes_nullable_pull_request_author(monkeypatch):
async def user():
return {"id": 1, "login": "timmy"}
async def empty_collection():
return []
async def pull_request_collection():
return [{
"id": 56,
"number": 56,
"title": "Nullable author",
"state": "open",
"user": None,
"html_url": "https://forge.example/pulls/56",
}]
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"] == ""