From a6adf7fc0171b06c7f33cc040ae67b2eea2d7c1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Dachary?= Date: Sun, 26 Nov 2023 06:33:49 +0100 Subject: [PATCH] Revert "test PATCH /api/v1/repos/{owner}/{repo}/issues/comments/{id}" This reverts commit 8726ce26356b1f23d8e177d5b1851570e409b7fd. --- tests/integration/api_comment_test.go | 16 +--------------- .../fixtures/TestAPIComment/comment.yml | 9 --------- 2 files changed, 1 insertion(+), 24 deletions(-) delete mode 100644 tests/integration/fixtures/TestAPIComment/comment.yml diff --git a/tests/integration/api_comment_test.go b/tests/integration/api_comment_test.go index 761d4b36af..0be4896105 100644 --- a/tests/integration/api_comment_test.go +++ b/tests/integration/api_comment_test.go @@ -174,29 +174,15 @@ func TestAPIGetSystemUserComment(t *testing.T) { } func TestAPIEditComment(t *testing.T) { - defer tests.AddFixtures("tests/integration/fixtures/TestAPIComment/")() defer tests.PrepareTestEnv(t)() 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)) issue := unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{ID: comment.IssueID}) repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: issue.RepoID}) 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) urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/issues/comments/%d?token=%s", repoOwner.Name, repo.Name, comment.ID, token) diff --git a/tests/integration/fixtures/TestAPIComment/comment.yml b/tests/integration/fixtures/TestAPIComment/comment.yml deleted file mode 100644 index bf5bc3486c..0000000000 --- a/tests/integration/fixtures/TestAPIComment/comment.yml +++ /dev/null @@ -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