summaryrefslogtreecommitdiffstats
path: root/integrations
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2021-06-17 16:02:34 +0200
committerGitHub <noreply@github.com>2021-06-17 16:02:34 +0200
commitb3fbd37e992cf3f9f42f49818087c67d464000eb (patch)
treeddb4aee79d6dfafaa3ff64acffed6f119c222acd /integrations
parent0db1048c3ab0b0802779fd84b86c4335c37e54b3 (diff)
downloadgitea-b3fbd37e992cf3f9f42f49818087c67d464000eb.tar.gz
gitea-b3fbd37e992cf3f9f42f49818087c67d464000eb.zip
[API] expose repo.GetReviewers() & repo.GetAssignees() (#16168)
* API: expose repo.GetReviewers() & repo.GetAssignees() * Add tests * fix unrelated swagger query type
Diffstat (limited to 'integrations')
-rw-r--r--integrations/api_repo_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/integrations/api_repo_test.go b/integrations/api_repo_test.go
index 1ca4575508..98c9fb6ec7 100644
--- a/integrations/api_repo_test.go
+++ b/integrations/api_repo_test.go
@@ -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)
+}