aboutsummaryrefslogtreecommitdiffstats
path: root/models/org_team_test.go
diff options
context:
space:
mode:
authorGusted <williamzijl7@hotmail.com>2022-02-01 20:09:24 +0100
committerGitHub <noreply@github.com>2022-02-01 14:09:24 -0500
commitd3b31cc1ee752e09e3062213eb4c34a6e9b0d7ff (patch)
treecfd1545886a9d4e0264fe60e496c1f8839efb7ae /models/org_team_test.go
parentf6f4e1ddb97227f1d0f2213b6dc9201f302568cf (diff)
downloadgitea-d3b31cc1ee752e09e3062213eb4c34a6e9b0d7ff.tar.gz
gitea-d3b31cc1ee752e09e3062213eb4c34a6e9b0d7ff.zip
Add `GetUserTeams` (#18499)
* COrrect use `UserID` in `SearchTeams` - Use `UserID` in the `SearchTeams` function, currently it was useless to pass such information. Now it does a INNER statement to `team_user` which obtains UserID -> TeamID data. - Make OrgID optional. - Resolves #18484 * Seperate searching specific user * Add condition back * Use correct struct type Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'models/org_team_test.go')
-rw-r--r--models/org_team_test.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/models/org_team_test.go b/models/org_team_test.go
index aa62cc58e2..cf3a797991 100644
--- a/models/org_team_test.go
+++ b/models/org_team_test.go
@@ -46,7 +46,7 @@ func TestTeam_GetRepositories(t *testing.T) {
test := func(teamID int64) {
team := unittest.AssertExistsAndLoadBean(t, &Team{ID: teamID}).(*Team)
- assert.NoError(t, team.GetRepositories(&SearchTeamOptions{}))
+ assert.NoError(t, team.GetRepositories(&SearchOrgTeamOptions{}))
assert.Len(t, team.Repos, team.NumRepos)
for _, repo := range team.Repos {
unittest.AssertExistsAndLoadBean(t, &TeamRepo{TeamID: teamID, RepoID: repo.ID})
@@ -292,7 +292,7 @@ func TestGetTeamMembers(t *testing.T) {
func TestGetUserTeams(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
test := func(userID int64) {
- teams, _, err := SearchTeam(&SearchTeamOptions{UserID: userID})
+ teams, _, err := GetUserTeams(&GetUserTeamOptions{UserID: userID})
assert.NoError(t, err)
for _, team := range teams {
unittest.AssertExistsAndLoadBean(t, &TeamUser{TeamID: team.ID, UID: userID})