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

This commit is contained in:
Lunny Xiao authored and GitHub committed 2024-11-26 21:55:06 +00:00
1 parent b6ce2d6dc9
commit f49d82309b
4 files changed
+47 -5

No files matched your search

+11
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)
}