From 0ee51a5221b14e6a944556381367db149ab55c4e Mon Sep 17 00:00:00 2001 From: Giteabot Date: Sat, 13 May 2023 18:08:53 -0400 Subject: [PATCH] Add test for api team organization (#24699) (#24702) Backport #24699 by @lunny Co-authored-by: Lunny Xiao --- tests/integration/api_team_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/integration/api_team_test.go b/tests/integration/api_team_test.go index 2801fdc98934..d548d18ce489 100644 --- a/tests/integration/api_team_test.go +++ b/tests/integration/api_team_test.go @@ -28,6 +28,7 @@ func TestAPITeam(t *testing.T) { teamUser := unittest.AssertExistsAndLoadBean(t, &organization.TeamUser{ID: 1}) team := unittest.AssertExistsAndLoadBean(t, &organization.Team{ID: teamUser.TeamID}) + org := unittest.AssertExistsAndLoadBean(t, &organization.Organization{ID: teamUser.OrgID}) user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: teamUser.UID}) session := loginUser(t, user.Name) @@ -39,6 +40,7 @@ func TestAPITeam(t *testing.T) { DecodeJSON(t, resp, &apiTeam) assert.EqualValues(t, team.ID, apiTeam.ID) assert.Equal(t, team.Name, apiTeam.Name) + assert.EqualValues(t, convert.ToOrganization(db.DefaultContext, org), apiTeam.Organization) // non team member user will not access the teams details teamUser2 := unittest.AssertExistsAndLoadBean(t, &organization.TeamUser{ID: 3}) @@ -57,7 +59,7 @@ func TestAPITeam(t *testing.T) { session = loginUser(t, user.Name) token = getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeAdminOrg) - org := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 6}) + org = unittest.AssertExistsAndLoadBean(t, &organization.Organization{ID: 6}) // Create team. teamToCreate := &api.CreateTeamOption{