Skip to content

Commit 9c0cc9b

Browse files
committed
Fix lint
1 parent e1fe318 commit 9c0cc9b

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

tests/integration/api_team_test.go

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111

1212
auth_model "code.gitea.io/gitea/models/auth"
1313
"code.gitea.io/gitea/models/db"
14-
"code.gitea.io/gitea/models/organization"
1514
org_model "code.gitea.io/gitea/models/organization"
1615
"code.gitea.io/gitea/models/perm"
1716
"code.gitea.io/gitea/models/repo"
@@ -28,9 +27,9 @@ import (
2827
func TestAPITeam(t *testing.T) {
2928
defer tests.PrepareTestEnv(t)()
3029

31-
teamUser := unittest.AssertExistsAndLoadBean(t, &organization.TeamUser{ID: 1})
32-
team := unittest.AssertExistsAndLoadBean(t, &organization.Team{ID: teamUser.TeamID})
33-
org := unittest.AssertExistsAndLoadBean(t, &organization.Organization{ID: teamUser.OrgID})
30+
teamUser := unittest.AssertExistsAndLoadBean(t, &org_model.TeamUser{ID: 1})
31+
team := unittest.AssertExistsAndLoadBean(t, &org_model.Team{ID: teamUser.TeamID})
32+
org := unittest.AssertExistsAndLoadBean(t, &org_model.Organization{ID: teamUser.OrgID})
3433
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: teamUser.UID})
3534

3635
session := loginUser(t, user.Name)
@@ -47,7 +46,7 @@ func TestAPITeam(t *testing.T) {
4746
assert.EqualValues(t, convert.ToOrganization(db.DefaultContext, org), apiTeam.Organization)
4847

4948
// non team member user will not access the teams details
50-
teamUser2 := unittest.AssertExistsAndLoadBean(t, &organization.TeamUser{ID: 3})
49+
teamUser2 := unittest.AssertExistsAndLoadBean(t, &org_model.TeamUser{ID: 3})
5150
user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: teamUser2.UID})
5251

5352
session = loginUser(t, user2.Name)
@@ -61,7 +60,7 @@ func TestAPITeam(t *testing.T) {
6160

6261
// Get an admin user able to create, update and delete teams.
6362
user = unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1})
64-
org = unittest.AssertExistsAndLoadBean(t, &organization.Organization{ID: 6})
63+
org = unittest.AssertExistsAndLoadBean(t, &org_model.Organization{ID: 6})
6564
session = loginUser(t, user.Name)
6665
token = getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteOrganization)
6766

@@ -140,7 +139,7 @@ func TestAPITeam(t *testing.T) {
140139
teamToEdit.Permission, unit.AllUnitKeyNames(), nil)
141140

142141
// Read team.
143-
teamRead := unittest.AssertExistsAndLoadBean(t, &organization.Team{ID: teamID})
142+
teamRead := unittest.AssertExistsAndLoadBean(t, &org_model.Team{ID: teamID})
144143
assert.NoError(t, teamRead.LoadUnits(db.DefaultContext))
145144
req = NewRequestf(t, "GET", "/api/v1/teams/%d", teamID).
146145
AddTokenAuth(token)
@@ -154,7 +153,7 @@ func TestAPITeam(t *testing.T) {
154153
req = NewRequestf(t, "DELETE", "/api/v1/teams/%d", teamID).
155154
AddTokenAuth(token)
156155
MakeRequest(t, req, http.StatusNoContent)
157-
unittest.AssertNotExistsBean(t, &organization.Team{ID: teamID})
156+
unittest.AssertNotExistsBean(t, &org_model.Team{ID: teamID})
158157

159158
// create team again via UnitsMap
160159
// Create team.
@@ -211,7 +210,7 @@ func TestAPITeam(t *testing.T) {
211210
"read", nil, teamToEdit.UnitsMap)
212211

213212
// Read team.
214-
teamRead = unittest.AssertExistsAndLoadBean(t, &organization.Team{ID: teamID})
213+
teamRead = unittest.AssertExistsAndLoadBean(t, &org_model.Team{ID: teamID})
215214
req = NewRequestf(t, "GET", "/api/v1/teams/%d", teamID).
216215
AddTokenAuth(token)
217216
resp = MakeRequest(t, req, http.StatusOK)
@@ -225,7 +224,7 @@ func TestAPITeam(t *testing.T) {
225224
req = NewRequestf(t, "DELETE", "/api/v1/teams/%d", teamID).
226225
AddTokenAuth(token)
227226
MakeRequest(t, req, http.StatusNoContent)
228-
unittest.AssertNotExistsBean(t, &organization.Team{ID: teamID})
227+
unittest.AssertNotExistsBean(t, &org_model.Team{ID: teamID})
229228

230229
// Create admin team
231230
teamToCreate = &api.CreateTeamOption{
@@ -244,7 +243,7 @@ func TestAPITeam(t *testing.T) {
244243
if ut == unit.TypeExternalTracker || ut == unit.TypeExternalWiki {
245244
up = perm.AccessModeRead
246245
}
247-
unittest.AssertExistsAndLoadBean(t, &organization.TeamUnit{
246+
unittest.AssertExistsAndLoadBean(t, &org_model.TeamUnit{
248247
OrgID: org.ID,
249248
TeamID: apiTeam.ID,
250249
Type: ut,
@@ -257,7 +256,7 @@ func TestAPITeam(t *testing.T) {
257256
req = NewRequestf(t, "DELETE", "/api/v1/teams/%d", teamID).
258257
AddTokenAuth(token)
259258
MakeRequest(t, req, http.StatusNoContent)
260-
unittest.AssertNotExistsBean(t, &organization.Team{ID: teamID})
259+
unittest.AssertNotExistsBean(t, &org_model.Team{ID: teamID})
261260
}
262261

263262
func checkTeamResponse(t *testing.T, testName string, apiTeam *api.Team, name, description string, includesAllRepositories bool, permission string, units []string, unitsMap map[string]string) {
@@ -278,7 +277,7 @@ func checkTeamResponse(t *testing.T, testName string, apiTeam *api.Team, name, d
278277
}
279278

280279
func checkTeamBean(t *testing.T, id int64, name, description string, includesAllRepositories bool, permission string, units []string, unitsMap map[string]string) {
281-
team := unittest.AssertExistsAndLoadBean(t, &organization.Team{ID: id})
280+
team := unittest.AssertExistsAndLoadBean(t, &org_model.Team{ID: id})
282281
assert.NoError(t, team.LoadUnits(db.DefaultContext), "LoadUnits")
283282
apiTeam, err := convert.ToTeam(db.DefaultContext, team)
284283
assert.NoError(t, err)
@@ -321,7 +320,7 @@ func TestAPIGetTeamRepo(t *testing.T) {
321320

322321
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 15})
323322
teamRepo := unittest.AssertExistsAndLoadBean(t, &repo.Repository{ID: 24})
324-
team := unittest.AssertExistsAndLoadBean(t, &organization.Team{ID: 5})
323+
team := unittest.AssertExistsAndLoadBean(t, &org_model.Team{ID: 5})
325324

326325
var results api.Repository
327326

tests/integration/org_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111

1212
auth_model "code.gitea.io/gitea/models/auth"
1313
"code.gitea.io/gitea/models/db"
14-
"code.gitea.io/gitea/models/organization"
1514
org_model "code.gitea.io/gitea/models/organization"
1615
"code.gitea.io/gitea/models/perm"
1716
"code.gitea.io/gitea/models/unittest"
@@ -230,7 +229,7 @@ func TestOwnerTeamsEdit(t *testing.T) {
230229
org := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 3, Type: user_model.UserTypeOrganization})
231230
session := loginUser(t, user1.Name)
232231

233-
team := unittest.AssertExistsAndLoadBean(t, &organization.Team{OrgID: org.ID, Name: org_model.OwnerTeamName})
232+
team := unittest.AssertExistsAndLoadBean(t, &org_model.Team{OrgID: org.ID, Name: org_model.OwnerTeamName})
234233
assert.EqualValues(t, perm.AccessModeOwner, team.AccessMode)
235234
assert.EqualValues(t, "", team.Description)
236235
assert.NoError(t, team.LoadUnits(db.DefaultContext))
@@ -247,7 +246,7 @@ func TestOwnerTeamsEdit(t *testing.T) {
247246
session.MakeRequest(t, req, http.StatusSeeOther)
248247

249248
// reload team
250-
team = unittest.AssertExistsAndLoadBean(t, &organization.Team{ID: team.ID})
249+
team = unittest.AssertExistsAndLoadBean(t, &org_model.Team{ID: team.ID})
251250
assert.EqualValues(t, perm.AccessModeOwner, team.AccessMode)
252251
assert.EqualValues(t, org_model.OwnerTeamName, team.Name)
253252
assert.EqualValues(t, "Just a description", team.Description)

0 commit comments

Comments
 (0)