1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-22 08:42:32 -05:00

Fix the logic of finding the latest pull review commit ID (#32139) (followup)

Adjust the tests for review deletion to ignore a newly inserted
fixture. It is a review request and cannot be deleted.
This commit is contained in:
Earl Warren 2024-10-06 10:00:09 +02:00
parent 700e9f027b
commit 00e5c68060
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -60,6 +60,9 @@ func TestAPIPullReviewCreateDeleteComment(t *testing.T) {
var reviews []*api.PullReview var reviews []*api.PullReview
DecodeJSON(t, resp, &reviews) DecodeJSON(t, resp, &reviews)
for _, review := range reviews { for _, review := range reviews {
if review.State == api.ReviewStateRequestReview {
continue
}
req := NewRequestf(t, http.MethodDelete, "/api/v1/repos/%s/pulls/%d/reviews/%d", repo.FullName(), pullIssue.Index, review.ID). req := NewRequestf(t, http.MethodDelete, "/api/v1/repos/%s/pulls/%d/reviews/%d", repo.FullName(), pullIssue.Index, review.ID).
AddTokenAuth(token) AddTokenAuth(token)
MakeRequest(t, req, http.StatusNoContent) MakeRequest(t, req, http.StatusNoContent)
@ -93,7 +96,7 @@ func TestAPIPullReviewCreateDeleteComment(t *testing.T) {
DecodeJSON(t, resp, &getReview) DecodeJSON(t, resp, &getReview)
require.EqualValues(t, getReview, review) require.EqualValues(t, getReview, review)
} }
requireReviewCount(1) requireReviewCount(2)
newCommentBody := "first new line" newCommentBody := "first new line"
var reviewComment api.PullReviewComment var reviewComment api.PullReviewComment
@ -140,7 +143,7 @@ func TestAPIPullReviewCreateDeleteComment(t *testing.T) {
AddTokenAuth(token) AddTokenAuth(token)
MakeRequest(t, req, http.StatusNoContent) MakeRequest(t, req, http.StatusNoContent)
} }
requireReviewCount(0) requireReviewCount(1)
}) })
} }
} }