Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-24 02:36:10 +01:00

test GET /{username}/{reponame}/{type:issues|pulls}/{index}/content-history/detail

(cherry picked from commit c0cf68e381)
This commit is contained in:
Loïc Dachary 2023-11-12 18:44:57 +01:00
parent 9ea9ba8e7e
commit 494728f919
No known key found for this signature in database
GPG key ID: 992D23B392F9E4F2

View file

@ -261,18 +261,29 @@ func TestIssueCommentUpdate(t *testing.T) {
assert.False(t, historyBefore.IsDeleted)
softDelete := fmt.Sprintf("content-history/soft-delete?comment_id=%d&history_id=%d", commentID, historyBefore.ID)
detail := fmt.Sprintf("content-history/detail?comment_id=%d&history_id=%d", commentID, historyBefore.ID)
// Using the ID of a comment that does not belong to the repository must fail
{
session5 := loginUser(t, "user5")
otherIssueURL := testNewIssue(t, session5, "user5", "repo4", "Other Title", "Other Description")
req = NewRequestWithValues(t, "GET", fmt.Sprintf("%s/%s", otherIssueURL, detail), map[string]string{
"_csrf": GetCSRF(t, session5, otherIssueURL),
})
session5.MakeRequest(t, req, http.StatusNotFound)
req = NewRequestWithValues(t, "POST", fmt.Sprintf("%s/%s", otherIssueURL, softDelete), map[string]string{
"_csrf": GetCSRF(t, session5, otherIssueURL),
})
session5.MakeRequest(t, req, http.StatusNotFound)
}
req = NewRequestWithValues(t, "GET", fmt.Sprintf("%s/%s", issueURL, detail), map[string]string{
"_csrf": GetCSRF(t, session, issueURL),
})
session.MakeRequest(t, req, http.StatusOK)
req = NewRequestWithValues(t, "POST", fmt.Sprintf("%s/%s", issueURL, softDelete), map[string]string{
"_csrf": GetCSRF(t, session, issueURL),
})