1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-12 13:37:20 +00:00

Introduce OrgList and add LoadTeams, optimaze Load teams for orgs (#32543)

This commit is contained in:
Lunny Xiao
2024-11-26 13:55:06 -08:00
committed by GitHub
parent b6ce2d6dc9
commit f49d82309b
4 changed files with 47 additions and 5 deletions

View File

@ -60,3 +60,14 @@ func TestGetUserOrgsList(t *testing.T) {
assert.EqualValues(t, 2, orgs[0].NumRepos)
}
}
func TestLoadOrgListTeams(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
orgs, err := organization.GetUserOrgsList(db.DefaultContext, &user_model.User{ID: 4})
assert.NoError(t, err)
assert.Len(t, orgs, 1)
teamsMap, err := organization.OrgList(orgs).LoadTeams(db.DefaultContext)
assert.NoError(t, err)
assert.Len(t, teamsMap, 1)
assert.Len(t, teamsMap[3], 5)
}