Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion tests/integration/api_team_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,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 @@ -40,6 +41,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 @@ -58,7 +60,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})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why user -> organization?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why user -> organization?

The previous org is a *User, now since org has been declared, so here we should use *Organization as org.


// Create team.
teamToCreate := &api.CreateTeamOption{
Expand Down