mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-14 05:56:14 +01:00
test GET /{username}/{reponame}/{type:issues|pulls}/{index}/content-history/detail
(cherry picked from commit c0cf68e381
)
This commit is contained in:
parent
9ea9ba8e7e
commit
494728f919
1 changed files with 11 additions and 0 deletions
|
@ -261,18 +261,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),
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue