Compare commits

..

No commits in common. "b2f8eaf89ab9975403f6147810b42370fe2dd0a7" and "d9ad68b72b1494e8f8ee9494bcd804b4677f4c9e" have entirely different histories.

2 changed files with 0 additions and 23 deletions

View File

@ -75,8 +75,6 @@ async def context() -> JSONResponse:
asyncio.gather(current_user(), repos(), issues(), pull_requests()), asyncio.gather(current_user(), repos(), issues(), pull_requests()),
timeout=CONTEXT_TIMEOUT_SECONDS, timeout=CONTEXT_TIMEOUT_SECONDS,
) )
if not isinstance(user_data, dict):
raise ValueError("Gitea current-user response was not an object")
except Exception as e: except Exception as e:
error_message = ( error_message = (
f"Gitea context request timed out after {CONTEXT_TIMEOUT_SECONDS:g}s" f"Gitea context request timed out after {CONTEXT_TIMEOUT_SECONDS:g}s"

View File

@ -167,24 +167,3 @@ async def test_context_normalizes_nullable_user_profile_fields(monkeypatch):
assert response.status_code == 200 assert response.status_code == 200
assert context["user"]["full_name"] == "" assert context["user"]["full_name"] == ""
assert context["user"]["email"] == "" assert context["user"]["email"] == ""
@pytest.mark.anyio
async def test_context_returns_fallback_for_null_current_user_payload(monkeypatch):
async def null_user():
return None
async def empty_collection():
return []
monkeypatch.setattr(main, "current_user", null_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["repos"] == []
assert context["error"] == "Gitea current-user response was not an object"