mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-23 08:47:42 -05:00
Revert "test PATCH /api/v1/repos/{owner}/{repo}/issues/comments/{id}"
This reverts commit 8726ce2635
.
This commit is contained in:
parent
4ece6a4b19
commit
a6adf7fc01
2 changed files with 1 additions and 24 deletions
|
@ -174,29 +174,15 @@ func TestAPIGetSystemUserComment(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAPIEditComment(t *testing.T) {
|
func TestAPIEditComment(t *testing.T) {
|
||||||
defer tests.AddFixtures("tests/integration/fixtures/TestAPIComment/")()
|
|
||||||
defer tests.PrepareTestEnv(t)()
|
defer tests.PrepareTestEnv(t)()
|
||||||
const newCommentBody = "This is the new comment body"
|
const newCommentBody = "This is the new comment body"
|
||||||
|
|
||||||
comment := unittest.AssertExistsAndLoadBean(t, &issues_model.Comment{ID: 1008},
|
comment := unittest.AssertExistsAndLoadBean(t, &issues_model.Comment{},
|
||||||
unittest.Cond("type = ?", issues_model.CommentTypeComment))
|
unittest.Cond("type = ?", issues_model.CommentTypeComment))
|
||||||
issue := unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{ID: comment.IssueID})
|
issue := unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{ID: comment.IssueID})
|
||||||
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: issue.RepoID})
|
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: issue.RepoID})
|
||||||
repoOwner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID})
|
repoOwner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID})
|
||||||
|
|
||||||
t.Run("UnrelatedCommentID", func(t *testing.T) {
|
|
||||||
// Using the ID of a comment that does not belong to the repository must fail
|
|
||||||
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 4})
|
|
||||||
repoOwner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID})
|
|
||||||
token := getUserToken(t, repoOwner.Name, auth_model.AccessTokenScopeWriteIssue)
|
|
||||||
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/issues/comments/%d?token=%s",
|
|
||||||
repoOwner.Name, repo.Name, comment.ID, token)
|
|
||||||
req := NewRequestWithValues(t, "PATCH", urlStr, map[string]string{
|
|
||||||
"body": newCommentBody,
|
|
||||||
})
|
|
||||||
MakeRequest(t, req, http.StatusNotFound)
|
|
||||||
})
|
|
||||||
|
|
||||||
token := getUserToken(t, repoOwner.Name, auth_model.AccessTokenScopeWriteIssue)
|
token := getUserToken(t, repoOwner.Name, auth_model.AccessTokenScopeWriteIssue)
|
||||||
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/issues/comments/%d?token=%s",
|
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/issues/comments/%d?token=%s",
|
||||||
repoOwner.Name, repo.Name, comment.ID, token)
|
repoOwner.Name, repo.Name, comment.ID, token)
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
|
|
||||||
-
|
|
||||||
id: 1008
|
|
||||||
type: 0 # comment
|
|
||||||
poster_id: 2
|
|
||||||
issue_id: 4 # in repo_id 2
|
|
||||||
content: "comment in private pository"
|
|
||||||
created_unix: 946684811
|
|
||||||
updated_unix: 946684811
|
|
Loading…
Reference in a new issue