Skip to content

Commit 0ee51a5

Browse files
GiteaBotlunny
andauthored
Add test for api team organization (#24699) (#24702)
Backport #24699 by @lunny Co-authored-by: Lunny Xiao <[email protected]>
1 parent da1c38d commit 0ee51a5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/integration/api_team_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ func TestAPITeam(t *testing.T) {
2828

2929
teamUser := unittest.AssertExistsAndLoadBean(t, &organization.TeamUser{ID: 1})
3030
team := unittest.AssertExistsAndLoadBean(t, &organization.Team{ID: teamUser.TeamID})
31+
org := unittest.AssertExistsAndLoadBean(t, &organization.Organization{ID: teamUser.OrgID})
3132
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: teamUser.UID})
3233

3334
session := loginUser(t, user.Name)
@@ -39,6 +40,7 @@ func TestAPITeam(t *testing.T) {
3940
DecodeJSON(t, resp, &apiTeam)
4041
assert.EqualValues(t, team.ID, apiTeam.ID)
4142
assert.Equal(t, team.Name, apiTeam.Name)
43+
assert.EqualValues(t, convert.ToOrganization(db.DefaultContext, org), apiTeam.Organization)
4244

4345
// non team member user will not access the teams details
4446
teamUser2 := unittest.AssertExistsAndLoadBean(t, &organization.TeamUser{ID: 3})
@@ -57,7 +59,7 @@ func TestAPITeam(t *testing.T) {
5759
session = loginUser(t, user.Name)
5860
token = getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeAdminOrg)
5961

60-
org := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 6})
62+
org = unittest.AssertExistsAndLoadBean(t, &organization.Organization{ID: 6})
6163

6264
// Create team.
6365
teamToCreate := &api.CreateTeamOption{

0 commit comments

Comments
 (0)