|
|
|
@ -494,3 +494,31 @@ func TestAPIRepoTransfer(t *testing.T) { |
|
|
|
|
repo = models.AssertExistsAndLoadBean(t, &models.Repository{ID: repo.ID}).(*models.Repository) |
|
|
|
|
_ = models.DeleteRepository(user, repo.OwnerID, repo.ID) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func TestAPIRepoGetReviewers(t *testing.T) { |
|
|
|
|
defer prepareTestEnv(t)() |
|
|
|
|
user := models.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User) |
|
|
|
|
session := loginUser(t, user.Name) |
|
|
|
|
token := getTokenForLoggedInUser(t, session) |
|
|
|
|
repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository) |
|
|
|
|
|
|
|
|
|
req := NewRequestf(t, "GET", "/api/v1/repos/%s/%s/reviewers?token=%s", user.Name, repo.Name, token) |
|
|
|
|
resp := session.MakeRequest(t, req, http.StatusOK) |
|
|
|
|
var reviewers []*api.User |
|
|
|
|
DecodeJSON(t, resp, &reviewers) |
|
|
|
|
assert.Len(t, reviewers, 4) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func TestAPIRepoGetAssignees(t *testing.T) { |
|
|
|
|
defer prepareTestEnv(t)() |
|
|
|
|
user := models.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User) |
|
|
|
|
session := loginUser(t, user.Name) |
|
|
|
|
token := getTokenForLoggedInUser(t, session) |
|
|
|
|
repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository) |
|
|
|
|
|
|
|
|
|
req := NewRequestf(t, "GET", "/api/v1/repos/%s/%s/assignees?token=%s", user.Name, repo.Name, token) |
|
|
|
|
resp := session.MakeRequest(t, req, http.StatusOK) |
|
|
|
|
var assignees []*api.User |
|
|
|
|
DecodeJSON(t, resp, &assignees) |
|
|
|
|
assert.Len(t, assignees, 1) |
|
|
|
|
} |
|
|
|
|