aboutsummaryrefslogtreecommitdiffstats
path: root/integrations
diff options
context:
space:
mode:
authorAaron Walker <awwalker3@gmail.com>2017-07-13 04:14:15 -0700
committerKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2017-07-13 13:14:15 +0200
commit6a3c03762a37f593ec8101c2005836ca44683e1d (patch)
treee0d47eef90cceef4563de05f480c0abcf707c4e2 /integrations
parentf011d6d4d7a53a99c9d213f686412513fe78d6a7 (diff)
downloadgitea-6a3c03762a37f593ec8101c2005836ca44683e1d.tar.gz
gitea-6a3c03762a37f593ec8101c2005836ca44683e1d.zip
API: support '/orgs/:org/repos' (#2047)
* API: support '/orgs/:org/repos'
Diffstat (limited to 'integrations')
-rw-r--r--integrations/api_repo_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/integrations/api_repo_test.go b/integrations/api_repo_test.go
index 8073f773ac..e89a6359ae 100644
--- a/integrations/api_repo_test.go
+++ b/integrations/api_repo_test.go
@@ -63,3 +63,24 @@ func TestAPIViewRepo(t *testing.T) {
assert.EqualValues(t, 1, repo.ID)
assert.EqualValues(t, "repo1", repo.Name)
}
+
+func TestAPIOrgRepos(t *testing.T) {
+ prepareTestEnv(t)
+ user := models.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User)
+ // User3 is an Org. Check their repos.
+ sourceOrg := models.AssertExistsAndLoadBean(t, &models.User{ID: 3}).(*models.User)
+ // Login as User2.
+ session := loginUser(t, user.Name)
+
+ req := NewRequestf(t, "GET", "/api/v1/orgs/%s/repos", sourceOrg.Name)
+ resp := session.MakeRequest(t, req, http.StatusOK)
+
+ var apiRepos []*api.Repository
+ DecodeJSON(t, resp, &apiRepos)
+ expectedLen := models.GetCount(t, models.Repository{OwnerID: sourceOrg.ID},
+ models.Cond("is_private = ?", false))
+ assert.Len(t, apiRepos, expectedLen)
+ for _, repo := range apiRepos {
+ assert.False(t, repo.Private)
+ }
+}