mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-15 07:09:47 +01: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:
parent
1bee6fa839
commit
6488d15860
1 changed files with 5 additions and 2 deletions
|
@ -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)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue