From 2e1d6d2ef2488296d45cf28caea44283c661d828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Dachary?= Date: Sun, 26 Nov 2023 06:33:36 +0100 Subject: [PATCH] Revert "test GET /{owner}/{repo}/comments/{id}/attachments" This reverts commit 4903135a93b35946f66c0669a6f454dad767fde8. --- tests/integration/issue_test.go | 50 --------------------------------- 1 file changed, 50 deletions(-) diff --git a/tests/integration/issue_test.go b/tests/integration/issue_test.go index 78bd49b2af..0ba895b4cc 100644 --- a/tests/integration/issue_test.go +++ b/tests/integration/issue_test.go @@ -229,56 +229,6 @@ func TestIssueCommentDelete(t *testing.T) { unittest.AssertNotExistsBean(t, &issues_model.Comment{ID: commentID}) } -func TestIssueCommentAttachment(t *testing.T) { - defer tests.PrepareTestEnv(t)() - const repoURL = "user2/repo1" - const content = "Test comment 4" - const status = "" - session := loginUser(t, "user2") - issueURL := testNewIssue(t, session, "user2", "repo1", "Title", "Description") - - req := NewRequest(t, "GET", issueURL) - resp := session.MakeRequest(t, req, http.StatusOK) - - htmlDoc := NewHTMLParser(t, resp.Body) - link, exists := htmlDoc.doc.Find("#comment-form").Attr("action") - assert.True(t, exists, "The template has changed") - - uuid := createAttachment(t, session, repoURL, "image.png", generateImg(), http.StatusOK) - - commentCount := htmlDoc.doc.Find(".comment-list .comment .render-content").Length() - - req = NewRequestWithValues(t, "POST", link, map[string]string{ - "_csrf": htmlDoc.GetCSRF(), - "content": content, - "status": status, - "files": uuid, - }) - resp = session.MakeRequest(t, req, http.StatusSeeOther) - - req = NewRequest(t, "GET", test.RedirectURL(resp)) - resp = session.MakeRequest(t, req, http.StatusOK) - - htmlDoc = NewHTMLParser(t, resp.Body) - - val := htmlDoc.doc.Find(".comment-list .comment .render-content p").Eq(commentCount).Text() - assert.Equal(t, content, val) - - idAttr, has := htmlDoc.doc.Find(".comment-list .comment").Eq(commentCount).Attr("id") - idStr := idAttr[strings.LastIndexByte(idAttr, '-')+1:] - assert.True(t, has) - id, err := strconv.Atoi(idStr) - assert.NoError(t, err) - assert.NotEqual(t, 0, id) - - req = NewRequest(t, "GET", fmt.Sprintf("/%s/%s/comments/%d/attachments", "user2", "repo1", id)) - session.MakeRequest(t, req, http.StatusOK) - - // Using the ID of a comment that does not belong to the repository must fail - req = NewRequest(t, "GET", fmt.Sprintf("/%s/%s/comments/%d/attachments", "user5", "repo4", id)) - session.MakeRequest(t, req, http.StatusNotFound) -} - func TestIssueCommentUpdate(t *testing.T) { defer tests.PrepareTestEnv(t)() session := loginUser(t, "user2")