Test that a proxy error page for one repo doesn't crash the run

This commit is contained in:
Mark Eaton committed 2026-11-11 19:47:53 -05:00
1 parent bfcac9b9ee
commit 1188b72263
2 files changed
+21 -2

No files matched your search

+12
View File
@@ -86,6 +86,18 @@ def test_repo_whose_languages_are_forbidden_is_skipped_with_a_warning(gitea, cap
)
def test_repo_whose_languages_return_a_proxy_error_page_is_skipped(gitea, capsys):
# A reverse proxy in front of Gitea answers a slow request with an HTML
# page, not JSON; trying to parse it would crash the whole run.
gitea.add("GET", WEBSITE_LANGS, b"<html><h1>504 Gateway Time-out</h1></html>", 504)
gitea.add("GET", SCRIPTS_LANGS, {"Python": 2000})
repos = [{"name": "website"}, {"name": "scripts"}]
assert aggregate_language_bytes(get_session(), repos) == {"Python": 2000}
assert (
"Warning: Could not fetch languages for website: 504" in capsys.readouterr().err
)
def test_error_message_inside_a_success_response_is_skipped_with_a_warning(
gitea, capsys
):