forked from forgejo/forgejo
[API] add GET /orgs endpoint (#9560)
* introduce `GET /orgs` * add TEST * show also other VisibleType's * update description * refactor a lot * SearchUserOptions by default return only public
This commit is contained in:
parent
497e15fdc2
commit
10055bd2b1
8 changed files with 108 additions and 9 deletions
|
@ -136,3 +136,17 @@ func TestAPIOrgDeny(t *testing.T) {
|
|||
MakeRequest(t, req, http.StatusNotFound)
|
||||
})
|
||||
}
|
||||
|
||||
func TestAPIGetAll(t *testing.T) {
|
||||
defer prepareTestEnv(t)()
|
||||
|
||||
req := NewRequestf(t, "GET", "/api/v1/orgs")
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
var apiOrgList []*api.Organization
|
||||
DecodeJSON(t, resp, &apiOrgList)
|
||||
|
||||
assert.Len(t, apiOrgList, 7)
|
||||
assert.Equal(t, "org25", apiOrgList[0].FullName)
|
||||
assert.Equal(t, "public", apiOrgList[0].Visibility)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue