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

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

This commit is contained in:
Loïc Dachary 2023-11-12 18:44:57 +01:00
parent a82cb96480
commit c0cf68e381
No known key found for this signature in database
GPG key ID: 992D23B392F9E4F2

View file

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