|
|
@ -29,7 +29,7 @@ func TestAPIPullReview(t *testing.T) { |
|
|
|
session := loginUser(t, "user2") |
|
|
|
session := loginUser(t, "user2") |
|
|
|
token := getTokenForLoggedInUser(t, session) |
|
|
|
token := getTokenForLoggedInUser(t, session) |
|
|
|
req := NewRequestf(t, http.MethodGet, "/api/v1/repos/%s/%s/pulls/%d/reviews?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, token) |
|
|
|
req := NewRequestf(t, http.MethodGet, "/api/v1/repos/%s/%s/pulls/%d/reviews?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, token) |
|
|
|
resp := session.MakeRequest(t, req, http.StatusOK) |
|
|
|
resp := MakeRequest(t, req, http.StatusOK) |
|
|
|
|
|
|
|
|
|
|
|
var reviews []*api.PullReview |
|
|
|
var reviews []*api.PullReview |
|
|
|
DecodeJSON(t, resp, &reviews) |
|
|
|
DecodeJSON(t, resp, &reviews) |
|
|
@ -54,20 +54,20 @@ func TestAPIPullReview(t *testing.T) { |
|
|
|
|
|
|
|
|
|
|
|
// test GetPullReview
|
|
|
|
// test GetPullReview
|
|
|
|
req = NewRequestf(t, http.MethodGet, "/api/v1/repos/%s/%s/pulls/%d/reviews/%d?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, reviews[3].ID, token) |
|
|
|
req = NewRequestf(t, http.MethodGet, "/api/v1/repos/%s/%s/pulls/%d/reviews/%d?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, reviews[3].ID, token) |
|
|
|
resp = session.MakeRequest(t, req, http.StatusOK) |
|
|
|
resp = MakeRequest(t, req, http.StatusOK) |
|
|
|
var review api.PullReview |
|
|
|
var review api.PullReview |
|
|
|
DecodeJSON(t, resp, &review) |
|
|
|
DecodeJSON(t, resp, &review) |
|
|
|
assert.EqualValues(t, *reviews[3], review) |
|
|
|
assert.EqualValues(t, *reviews[3], review) |
|
|
|
|
|
|
|
|
|
|
|
req = NewRequestf(t, "GET", "/api/v1/repos/%s/%s/pulls/%d/reviews/%d?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, reviews[5].ID, token) |
|
|
|
req = NewRequestf(t, "GET", "/api/v1/repos/%s/%s/pulls/%d/reviews/%d?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, reviews[5].ID, token) |
|
|
|
resp = session.MakeRequest(t, req, http.StatusOK) |
|
|
|
resp = MakeRequest(t, req, http.StatusOK) |
|
|
|
DecodeJSON(t, resp, &review) |
|
|
|
DecodeJSON(t, resp, &review) |
|
|
|
assert.EqualValues(t, *reviews[5], review) |
|
|
|
assert.EqualValues(t, *reviews[5], review) |
|
|
|
|
|
|
|
|
|
|
|
// test GetPullReviewComments
|
|
|
|
// test GetPullReviewComments
|
|
|
|
comment := unittest.AssertExistsAndLoadBean(t, &issues_model.Comment{ID: 7}) |
|
|
|
comment := unittest.AssertExistsAndLoadBean(t, &issues_model.Comment{ID: 7}) |
|
|
|
req = NewRequestf(t, http.MethodGet, "/api/v1/repos/%s/%s/pulls/%d/reviews/%d/comments?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, 10, token) |
|
|
|
req = NewRequestf(t, http.MethodGet, "/api/v1/repos/%s/%s/pulls/%d/reviews/%d/comments?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, 10, token) |
|
|
|
resp = session.MakeRequest(t, req, http.StatusOK) |
|
|
|
resp = MakeRequest(t, req, http.StatusOK) |
|
|
|
var reviewComments []*api.PullReviewComment |
|
|
|
var reviewComments []*api.PullReviewComment |
|
|
|
DecodeJSON(t, resp, &reviewComments) |
|
|
|
DecodeJSON(t, resp, &reviewComments) |
|
|
|
assert.Len(t, reviewComments, 1) |
|
|
|
assert.Len(t, reviewComments, 1) |
|
|
@ -100,7 +100,7 @@ func TestAPIPullReview(t *testing.T) { |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}) |
|
|
|
}) |
|
|
|
resp = session.MakeRequest(t, req, http.StatusOK) |
|
|
|
resp = MakeRequest(t, req, http.StatusOK) |
|
|
|
DecodeJSON(t, resp, &review) |
|
|
|
DecodeJSON(t, resp, &review) |
|
|
|
assert.EqualValues(t, 6, review.ID) |
|
|
|
assert.EqualValues(t, 6, review.ID) |
|
|
|
assert.EqualValues(t, "PENDING", review.State) |
|
|
|
assert.EqualValues(t, "PENDING", review.State) |
|
|
@ -111,7 +111,7 @@ func TestAPIPullReview(t *testing.T) { |
|
|
|
Event: "APPROVED", |
|
|
|
Event: "APPROVED", |
|
|
|
Body: "just two nits", |
|
|
|
Body: "just two nits", |
|
|
|
}) |
|
|
|
}) |
|
|
|
resp = session.MakeRequest(t, req, http.StatusOK) |
|
|
|
resp = MakeRequest(t, req, http.StatusOK) |
|
|
|
DecodeJSON(t, resp, &review) |
|
|
|
DecodeJSON(t, resp, &review) |
|
|
|
assert.EqualValues(t, 6, review.ID) |
|
|
|
assert.EqualValues(t, 6, review.ID) |
|
|
|
assert.EqualValues(t, "APPROVED", review.State) |
|
|
|
assert.EqualValues(t, "APPROVED", review.State) |
|
|
@ -121,14 +121,14 @@ func TestAPIPullReview(t *testing.T) { |
|
|
|
req = NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/reviews/%d/dismissals?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, review.ID, token), &api.DismissPullReviewOptions{ |
|
|
|
req = NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/reviews/%d/dismissals?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, review.ID, token), &api.DismissPullReviewOptions{ |
|
|
|
Message: "test", |
|
|
|
Message: "test", |
|
|
|
}) |
|
|
|
}) |
|
|
|
resp = session.MakeRequest(t, req, http.StatusOK) |
|
|
|
resp = MakeRequest(t, req, http.StatusOK) |
|
|
|
DecodeJSON(t, resp, &review) |
|
|
|
DecodeJSON(t, resp, &review) |
|
|
|
assert.EqualValues(t, 6, review.ID) |
|
|
|
assert.EqualValues(t, 6, review.ID) |
|
|
|
assert.True(t, review.Dismissed) |
|
|
|
assert.True(t, review.Dismissed) |
|
|
|
|
|
|
|
|
|
|
|
// test dismiss review
|
|
|
|
// test dismiss review
|
|
|
|
req = NewRequest(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/reviews/%d/undismissals?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, review.ID, token)) |
|
|
|
req = NewRequest(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/reviews/%d/undismissals?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, review.ID, token)) |
|
|
|
resp = session.MakeRequest(t, req, http.StatusOK) |
|
|
|
resp = MakeRequest(t, req, http.StatusOK) |
|
|
|
DecodeJSON(t, resp, &review) |
|
|
|
DecodeJSON(t, resp, &review) |
|
|
|
assert.EqualValues(t, 6, review.ID) |
|
|
|
assert.EqualValues(t, 6, review.ID) |
|
|
|
assert.False(t, review.Dismissed) |
|
|
|
assert.False(t, review.Dismissed) |
|
|
@ -138,12 +138,12 @@ func TestAPIPullReview(t *testing.T) { |
|
|
|
Body: "just a comment", |
|
|
|
Body: "just a comment", |
|
|
|
Event: "COMMENT", |
|
|
|
Event: "COMMENT", |
|
|
|
}) |
|
|
|
}) |
|
|
|
resp = session.MakeRequest(t, req, http.StatusOK) |
|
|
|
resp = MakeRequest(t, req, http.StatusOK) |
|
|
|
DecodeJSON(t, resp, &review) |
|
|
|
DecodeJSON(t, resp, &review) |
|
|
|
assert.EqualValues(t, "COMMENT", review.State) |
|
|
|
assert.EqualValues(t, "COMMENT", review.State) |
|
|
|
assert.EqualValues(t, 0, review.CodeCommentsCount) |
|
|
|
assert.EqualValues(t, 0, review.CodeCommentsCount) |
|
|
|
req = NewRequestf(t, http.MethodDelete, "/api/v1/repos/%s/%s/pulls/%d/reviews/%d?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, review.ID, token) |
|
|
|
req = NewRequestf(t, http.MethodDelete, "/api/v1/repos/%s/%s/pulls/%d/reviews/%d?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, review.ID, token) |
|
|
|
session.MakeRequest(t, req, http.StatusNoContent) |
|
|
|
MakeRequest(t, req, http.StatusNoContent) |
|
|
|
|
|
|
|
|
|
|
|
// test CreatePullReview Comment without body but with comments
|
|
|
|
// test CreatePullReview Comment without body but with comments
|
|
|
|
req = NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/reviews?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, token), &api.CreatePullReviewOptions{ |
|
|
|
req = NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/reviews?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, token), &api.CreatePullReviewOptions{ |
|
|
@ -165,7 +165,7 @@ func TestAPIPullReview(t *testing.T) { |
|
|
|
}) |
|
|
|
}) |
|
|
|
var commentReview api.PullReview |
|
|
|
var commentReview api.PullReview |
|
|
|
|
|
|
|
|
|
|
|
resp = session.MakeRequest(t, req, http.StatusOK) |
|
|
|
resp = MakeRequest(t, req, http.StatusOK) |
|
|
|
DecodeJSON(t, resp, &commentReview) |
|
|
|
DecodeJSON(t, resp, &commentReview) |
|
|
|
assert.EqualValues(t, "COMMENT", commentReview.State) |
|
|
|
assert.EqualValues(t, "COMMENT", commentReview.State) |
|
|
|
assert.EqualValues(t, 2, commentReview.CodeCommentsCount) |
|
|
|
assert.EqualValues(t, 2, commentReview.CodeCommentsCount) |
|
|
@ -180,7 +180,7 @@ func TestAPIPullReview(t *testing.T) { |
|
|
|
Comments: []api.CreatePullReviewComment{}, |
|
|
|
Comments: []api.CreatePullReviewComment{}, |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
resp = session.MakeRequest(t, req, http.StatusOK) |
|
|
|
resp = MakeRequest(t, req, http.StatusOK) |
|
|
|
DecodeJSON(t, resp, &commentReview) |
|
|
|
DecodeJSON(t, resp, &commentReview) |
|
|
|
assert.EqualValues(t, "COMMENT", commentReview.State) |
|
|
|
assert.EqualValues(t, "COMMENT", commentReview.State) |
|
|
|
assert.EqualValues(t, 0, commentReview.CodeCommentsCount) |
|
|
|
assert.EqualValues(t, 0, commentReview.CodeCommentsCount) |
|
|
@ -193,7 +193,7 @@ func TestAPIPullReview(t *testing.T) { |
|
|
|
Event: "COMMENT", |
|
|
|
Event: "COMMENT", |
|
|
|
Comments: []api.CreatePullReviewComment{}, |
|
|
|
Comments: []api.CreatePullReviewComment{}, |
|
|
|
}) |
|
|
|
}) |
|
|
|
resp = session.MakeRequest(t, req, http.StatusUnprocessableEntity) |
|
|
|
resp = MakeRequest(t, req, http.StatusUnprocessableEntity) |
|
|
|
errMap := make(map[string]interface{}) |
|
|
|
errMap := make(map[string]interface{}) |
|
|
|
json.Unmarshal(resp.Body.Bytes(), &errMap) |
|
|
|
json.Unmarshal(resp.Body.Bytes(), &errMap) |
|
|
|
assert.EqualValues(t, "review event COMMENT requires a body or a comment", errMap["message"].(string)) |
|
|
|
assert.EqualValues(t, "review event COMMENT requires a body or a comment", errMap["message"].(string)) |
|
|
@ -205,7 +205,7 @@ func TestAPIPullReview(t *testing.T) { |
|
|
|
repo3 := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: pullIssue12.RepoID}) |
|
|
|
repo3 := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: pullIssue12.RepoID}) |
|
|
|
|
|
|
|
|
|
|
|
req = NewRequestf(t, http.MethodGet, "/api/v1/repos/%s/%s/pulls/%d/reviews?token=%s", repo3.OwnerName, repo3.Name, pullIssue12.Index, token) |
|
|
|
req = NewRequestf(t, http.MethodGet, "/api/v1/repos/%s/%s/pulls/%d/reviews?token=%s", repo3.OwnerName, repo3.Name, pullIssue12.Index, token) |
|
|
|
resp = session.MakeRequest(t, req, http.StatusOK) |
|
|
|
resp = MakeRequest(t, req, http.StatusOK) |
|
|
|
DecodeJSON(t, resp, &reviews) |
|
|
|
DecodeJSON(t, resp, &reviews) |
|
|
|
assert.EqualValues(t, 11, reviews[0].ID) |
|
|
|
assert.EqualValues(t, 11, reviews[0].ID) |
|
|
|
assert.EqualValues(t, "REQUEST_REVIEW", reviews[0].State) |
|
|
|
assert.EqualValues(t, "REQUEST_REVIEW", reviews[0].State) |
|
|
@ -234,19 +234,19 @@ func TestAPIPullReviewRequest(t *testing.T) { |
|
|
|
req := NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/requested_reviewers?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, token), &api.PullReviewRequestOptions{ |
|
|
|
req := NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/requested_reviewers?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, token), &api.PullReviewRequestOptions{ |
|
|
|
Reviewers: []string{"user4@example.com", "user8"}, |
|
|
|
Reviewers: []string{"user4@example.com", "user8"}, |
|
|
|
}) |
|
|
|
}) |
|
|
|
session.MakeRequest(t, req, http.StatusCreated) |
|
|
|
MakeRequest(t, req, http.StatusCreated) |
|
|
|
|
|
|
|
|
|
|
|
// poster of pr can't be reviewer
|
|
|
|
// poster of pr can't be reviewer
|
|
|
|
req = NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/requested_reviewers?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, token), &api.PullReviewRequestOptions{ |
|
|
|
req = NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/requested_reviewers?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, token), &api.PullReviewRequestOptions{ |
|
|
|
Reviewers: []string{"user1"}, |
|
|
|
Reviewers: []string{"user1"}, |
|
|
|
}) |
|
|
|
}) |
|
|
|
session.MakeRequest(t, req, http.StatusUnprocessableEntity) |
|
|
|
MakeRequest(t, req, http.StatusUnprocessableEntity) |
|
|
|
|
|
|
|
|
|
|
|
// test user not exist
|
|
|
|
// test user not exist
|
|
|
|
req = NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/requested_reviewers?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, token), &api.PullReviewRequestOptions{ |
|
|
|
req = NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/requested_reviewers?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, token), &api.PullReviewRequestOptions{ |
|
|
|
Reviewers: []string{"testOther"}, |
|
|
|
Reviewers: []string{"testOther"}, |
|
|
|
}) |
|
|
|
}) |
|
|
|
session.MakeRequest(t, req, http.StatusNotFound) |
|
|
|
MakeRequest(t, req, http.StatusNotFound) |
|
|
|
|
|
|
|
|
|
|
|
// Test Remove Review Request
|
|
|
|
// Test Remove Review Request
|
|
|
|
session2 := loginUser(t, "user4") |
|
|
|
session2 := loginUser(t, "user4") |
|
|
@ -255,18 +255,18 @@ func TestAPIPullReviewRequest(t *testing.T) { |
|
|
|
req = NewRequestWithJSON(t, http.MethodDelete, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/requested_reviewers?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, token2), &api.PullReviewRequestOptions{ |
|
|
|
req = NewRequestWithJSON(t, http.MethodDelete, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/requested_reviewers?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, token2), &api.PullReviewRequestOptions{ |
|
|
|
Reviewers: []string{"user4"}, |
|
|
|
Reviewers: []string{"user4"}, |
|
|
|
}) |
|
|
|
}) |
|
|
|
session.MakeRequest(t, req, http.StatusNoContent) |
|
|
|
MakeRequest(t, req, http.StatusNoContent) |
|
|
|
|
|
|
|
|
|
|
|
// doer is not admin
|
|
|
|
// doer is not admin
|
|
|
|
req = NewRequestWithJSON(t, http.MethodDelete, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/requested_reviewers?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, token2), &api.PullReviewRequestOptions{ |
|
|
|
req = NewRequestWithJSON(t, http.MethodDelete, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/requested_reviewers?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, token2), &api.PullReviewRequestOptions{ |
|
|
|
Reviewers: []string{"user8"}, |
|
|
|
Reviewers: []string{"user8"}, |
|
|
|
}) |
|
|
|
}) |
|
|
|
session.MakeRequest(t, req, http.StatusUnprocessableEntity) |
|
|
|
MakeRequest(t, req, http.StatusUnprocessableEntity) |
|
|
|
|
|
|
|
|
|
|
|
req = NewRequestWithJSON(t, http.MethodDelete, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/requested_reviewers?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, token), &api.PullReviewRequestOptions{ |
|
|
|
req = NewRequestWithJSON(t, http.MethodDelete, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/requested_reviewers?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, token), &api.PullReviewRequestOptions{ |
|
|
|
Reviewers: []string{"user8"}, |
|
|
|
Reviewers: []string{"user8"}, |
|
|
|
}) |
|
|
|
}) |
|
|
|
session.MakeRequest(t, req, http.StatusNoContent) |
|
|
|
MakeRequest(t, req, http.StatusNoContent) |
|
|
|
|
|
|
|
|
|
|
|
// Test team review request
|
|
|
|
// Test team review request
|
|
|
|
pullIssue12 := unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{ID: 12}) |
|
|
|
pullIssue12 := unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{ID: 12}) |
|
|
@ -277,30 +277,30 @@ func TestAPIPullReviewRequest(t *testing.T) { |
|
|
|
req = NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/requested_reviewers?token=%s", repo3.OwnerName, repo3.Name, pullIssue12.Index, token), &api.PullReviewRequestOptions{ |
|
|
|
req = NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/requested_reviewers?token=%s", repo3.OwnerName, repo3.Name, pullIssue12.Index, token), &api.PullReviewRequestOptions{ |
|
|
|
TeamReviewers: []string{"team1", "owners"}, |
|
|
|
TeamReviewers: []string{"team1", "owners"}, |
|
|
|
}) |
|
|
|
}) |
|
|
|
session.MakeRequest(t, req, http.StatusCreated) |
|
|
|
MakeRequest(t, req, http.StatusCreated) |
|
|
|
|
|
|
|
|
|
|
|
// Test add Team Review Request to not allowned
|
|
|
|
// Test add Team Review Request to not allowned
|
|
|
|
req = NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/requested_reviewers?token=%s", repo3.OwnerName, repo3.Name, pullIssue12.Index, token), &api.PullReviewRequestOptions{ |
|
|
|
req = NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/requested_reviewers?token=%s", repo3.OwnerName, repo3.Name, pullIssue12.Index, token), &api.PullReviewRequestOptions{ |
|
|
|
TeamReviewers: []string{"test_team"}, |
|
|
|
TeamReviewers: []string{"test_team"}, |
|
|
|
}) |
|
|
|
}) |
|
|
|
session.MakeRequest(t, req, http.StatusUnprocessableEntity) |
|
|
|
MakeRequest(t, req, http.StatusUnprocessableEntity) |
|
|
|
|
|
|
|
|
|
|
|
// Test add Team Review Request to not exist
|
|
|
|
// Test add Team Review Request to not exist
|
|
|
|
req = NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/requested_reviewers?token=%s", repo3.OwnerName, repo3.Name, pullIssue12.Index, token), &api.PullReviewRequestOptions{ |
|
|
|
req = NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/requested_reviewers?token=%s", repo3.OwnerName, repo3.Name, pullIssue12.Index, token), &api.PullReviewRequestOptions{ |
|
|
|
TeamReviewers: []string{"not_exist_team"}, |
|
|
|
TeamReviewers: []string{"not_exist_team"}, |
|
|
|
}) |
|
|
|
}) |
|
|
|
session.MakeRequest(t, req, http.StatusNotFound) |
|
|
|
MakeRequest(t, req, http.StatusNotFound) |
|
|
|
|
|
|
|
|
|
|
|
// Test Remove team Review Request
|
|
|
|
// Test Remove team Review Request
|
|
|
|
req = NewRequestWithJSON(t, http.MethodDelete, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/requested_reviewers?token=%s", repo3.OwnerName, repo3.Name, pullIssue12.Index, token), &api.PullReviewRequestOptions{ |
|
|
|
req = NewRequestWithJSON(t, http.MethodDelete, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/requested_reviewers?token=%s", repo3.OwnerName, repo3.Name, pullIssue12.Index, token), &api.PullReviewRequestOptions{ |
|
|
|
TeamReviewers: []string{"team1"}, |
|
|
|
TeamReviewers: []string{"team1"}, |
|
|
|
}) |
|
|
|
}) |
|
|
|
session.MakeRequest(t, req, http.StatusNoContent) |
|
|
|
MakeRequest(t, req, http.StatusNoContent) |
|
|
|
|
|
|
|
|
|
|
|
// empty request test
|
|
|
|
// empty request test
|
|
|
|
req = NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/requested_reviewers?token=%s", repo3.OwnerName, repo3.Name, pullIssue12.Index, token), &api.PullReviewRequestOptions{}) |
|
|
|
req = NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/requested_reviewers?token=%s", repo3.OwnerName, repo3.Name, pullIssue12.Index, token), &api.PullReviewRequestOptions{}) |
|
|
|
session.MakeRequest(t, req, http.StatusCreated) |
|
|
|
MakeRequest(t, req, http.StatusCreated) |
|
|
|
|
|
|
|
|
|
|
|
req = NewRequestWithJSON(t, http.MethodDelete, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/requested_reviewers?token=%s", repo3.OwnerName, repo3.Name, pullIssue12.Index, token), &api.PullReviewRequestOptions{}) |
|
|
|
req = NewRequestWithJSON(t, http.MethodDelete, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/requested_reviewers?token=%s", repo3.OwnerName, repo3.Name, pullIssue12.Index, token), &api.PullReviewRequestOptions{}) |
|
|
|
session.MakeRequest(t, req, http.StatusNoContent) |
|
|
|
MakeRequest(t, req, http.StatusNoContent) |
|
|
|
} |
|
|
|
} |
|
|
|