mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-24 15:23:33 +01:00
Backport #24699 by @lunny
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
(cherry picked from commit 0ee51a5221
)
This commit is contained in:
parent
bfa368adbe
commit
e12f550fed
1 changed files with 3 additions and 1 deletions
|
@ -28,6 +28,7 @@ func TestAPITeam(t *testing.T) {
|
||||||
|
|
||||||
teamUser := unittest.AssertExistsAndLoadBean(t, &organization.TeamUser{ID: 1})
|
teamUser := unittest.AssertExistsAndLoadBean(t, &organization.TeamUser{ID: 1})
|
||||||
team := unittest.AssertExistsAndLoadBean(t, &organization.Team{ID: teamUser.TeamID})
|
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})
|
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: teamUser.UID})
|
||||||
|
|
||||||
session := loginUser(t, user.Name)
|
session := loginUser(t, user.Name)
|
||||||
|
@ -39,6 +40,7 @@ func TestAPITeam(t *testing.T) {
|
||||||
DecodeJSON(t, resp, &apiTeam)
|
DecodeJSON(t, resp, &apiTeam)
|
||||||
assert.EqualValues(t, team.ID, apiTeam.ID)
|
assert.EqualValues(t, team.ID, apiTeam.ID)
|
||||||
assert.Equal(t, team.Name, apiTeam.Name)
|
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
|
// non team member user will not access the teams details
|
||||||
teamUser2 := unittest.AssertExistsAndLoadBean(t, &organization.TeamUser{ID: 3})
|
teamUser2 := unittest.AssertExistsAndLoadBean(t, &organization.TeamUser{ID: 3})
|
||||||
|
@ -57,7 +59,7 @@ func TestAPITeam(t *testing.T) {
|
||||||
session = loginUser(t, user.Name)
|
session = loginUser(t, user.Name)
|
||||||
token = getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeAdminOrg)
|
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.
|
// Create team.
|
||||||
teamToCreate := &api.CreateTeamOption{
|
teamToCreate := &api.CreateTeamOption{
|
||||||
|
|
Loading…
Reference in a new issue