From 3f990c841d0ffd909fbb41dca6678c0add7412a1 Mon Sep 17 00:00:00 2001 From: unkin-agent Date: Sat, 19 Sep 2026 12:44:00 +1000 Subject: [PATCH] Mock the 404 body Gitea really returns --- internal/agent/client_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/agent/client_test.go b/internal/agent/client_test.go index e0cb8c8..c1aacfc 100644 --- a/internal/agent/client_test.go +++ b/internal/agent/client_test.go @@ -156,7 +156,7 @@ func TestEditPRAPIError(t *testing.T) { mux := http.NewServeMux() mux.HandleFunc("/api/v1/repos/unkin/repo/pulls/7", func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusNotFound) - _, _ = io.WriteString(w, `{"message":"pull request does not exist"}`) + _, _ = io.WriteString(w, `{"message":"not found","url":"https://git.unkin.net/api/swagger","errors":null}`) }) srv := httptest.NewServer(mux) defer srv.Close() @@ -167,7 +167,7 @@ func TestEditPRAPIError(t *testing.T) { if err == nil { t.Fatal("expected error on 404") } - if !strings.Contains(err.Error(), "pull request does not exist") { + if !strings.Contains(err.Error(), `"message":"not found"`) { t.Errorf("error %q should carry the API message", err) } }