fix: normalize nullable user profile fields (#73)
CI / lint (pull_request) Successful in 7s
CI / build-frontend (pull_request) Successful in 4s

This commit is contained in:
timmy committed 2026-08-06 05:03:04 +00:00
1 parent af7f2ff92a
commit 902db45741
2 files changed
+27 -1

No files matched your search

+26
View File
@@ -141,3 +141,29 @@ async def test_context_normalizes_null_collection_payloads(monkeypatch):
assert context["repos"] == []
assert context["issues"] == []
assert context["pull_requests"] == []
@pytest.mark.anyio
async def test_context_normalizes_nullable_user_profile_fields(monkeypatch):
async def user():
return {
"id": 1,
"login": "timmy",
"full_name": None,
"email": None,
}
async def empty_collection():
return []
monkeypatch.setattr(main, "current_user", user)
monkeypatch.setattr(main, "repos", empty_collection)
monkeypatch.setattr(main, "issues", empty_collection)
monkeypatch.setattr(main, "pull_requests", empty_collection)
response = await main.context()
context = json.loads(response.body)
assert response.status_code == 200
assert context["user"]["full_name"] == ""
assert context["user"]["email"] == ""