diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-03-19 12:19:48 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-19 04:19:48 +0000 |
commit | 828701ff2de67e179e79c79e6b52e92e770df789 (patch) | |
tree | 530bdd985a948f53af1d4a59125e90e131b73521 /routers/web/repo | |
parent | 0e183d81fc5283f9d2047472de580e4f04a046c1 (diff) | |
download | gitea-828701ff2de67e179e79c79e6b52e92e770df789.tar.gz gitea-828701ff2de67e179e79c79e6b52e92e770df789.zip |
Fix template error when comment review doesn't exist (#29888)
Fix #29885
Diffstat (limited to 'routers/web/repo')
-rw-r--r-- | routers/web/repo/pull_review_test.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/routers/web/repo/pull_review_test.go b/routers/web/repo/pull_review_test.go index 5f035f1eb0..8344ff4091 100644 --- a/routers/web/repo/pull_review_test.go +++ b/routers/web/repo/pull_review_test.go @@ -4,6 +4,7 @@ package repo import ( + "net/http" "net/http/httptest" "testing" @@ -73,4 +74,20 @@ func TestRenderConversation(t *testing.T) { renderConversation(ctx, preparedComment, "timeline") assert.Contains(t, resp.Body.String(), `<div id="code-comments-`) }) + run("diff non-existing review", func(t *testing.T, ctx *context.Context, resp *httptest.ResponseRecorder) { + err := db.TruncateBeans(db.DefaultContext, &issues_model.Review{}) + assert.NoError(t, err) + ctx.Data["ShowOutdatedComments"] = true + renderConversation(ctx, preparedComment, "diff") + assert.Equal(t, http.StatusOK, resp.Code) + assert.NotContains(t, resp.Body.String(), `status-page-500`) + }) + run("timeline non-existing review", func(t *testing.T, ctx *context.Context, resp *httptest.ResponseRecorder) { + err := db.TruncateBeans(db.DefaultContext, &issues_model.Review{}) + assert.NoError(t, err) + ctx.Data["ShowOutdatedComments"] = true + renderConversation(ctx, preparedComment, "timeline") + assert.Equal(t, http.StatusOK, resp.Code) + assert.NotContains(t, resp.Body.String(), `status-page-500`) + }) } |