diff options
author | oliverpool <git@olivier.pfad.fr> | 2024-03-25 16:17:02 +0100 |
---|---|---|
committer | oliverpool <git@olivier.pfad.fr> | 2024-03-31 13:53:47 +0200 |
commit | 6b857193ff6d159e249c6d9036b242975584ea8f (patch) | |
tree | 1b65f33c7d56e64e80df859fd89d090c3a80243d /routers | |
parent | Merge pull request 'English improvements' (#2703) from 0ko/forgejo:english202... (diff) | |
download | forgejo-6b857193ff6d159e249c6d9036b242975584ea8f.tar.xz forgejo-6b857193ff6d159e249c6d9036b242975584ea8f.zip |
[TESTS] pull review deleted from gitea#29888
Instead of db.TruncateBeans(db.DefaultContext, &issues_model.Review{}), reviews are deleted using issue.DeleteReview
Diffstat (limited to 'routers')
-rw-r--r-- | routers/web/repo/pull_review_test.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/routers/web/repo/pull_review_test.go b/routers/web/repo/pull_review_test.go index d87656f796..70f6a0e055 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" @@ -75,4 +76,30 @@ 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) { + reviews, err := issues_model.FindReviews(db.DefaultContext, issues_model.FindReviewOptions{ + IssueID: 2, + }) + assert.NoError(t, err) + for _, r := range reviews { + assert.NoError(t, issues_model.DeleteReview(db.DefaultContext, r)) + } + 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) { + reviews, err := issues_model.FindReviews(db.DefaultContext, issues_model.FindReviewOptions{ + IssueID: 2, + }) + assert.NoError(t, err) + for _, r := range reviews { + assert.NoError(t, issues_model.DeleteReview(db.DefaultContext, r)) + } + ctx.Data["ShowOutdatedComments"] = true + renderConversation(ctx, preparedComment, "timeline") + assert.Equal(t, http.StatusOK, resp.Code) + assert.NotContains(t, resp.Body.String(), `status-page-500`) + }) } |