Skip to content

Commit

Permalink
Add test for api team organization (#24699) (#24702)
Browse files Browse the repository at this point in the history
Backport #24699 by @lunny

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
  • Loading branch information
GiteaBot and lunny authored May 13, 2023
1 parent da1c38d commit 0ee51a5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/integration/api_team_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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})
Expand All @@ -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{
Expand Down

0 comments on commit 0ee51a5

Please sign in to comment.