mirror of
https://github.com/go-gitea/gitea
synced 2025-07-03 09:07:19 +00:00
Fix template error when comment review doesn't exist (#29888)
Fix #29885
This commit is contained in:
@ -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`)
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user