diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/integration/api_comment_test.go | 2 | ||||
-rw-r--r-- | tests/integration/api_issue_reaction_test.go | 6 | ||||
-rw-r--r-- | tests/integration/api_team_test.go | 3 | ||||
-rw-r--r-- | tests/integration/api_team_user_test.go | 3 | ||||
-rw-r--r-- | tests/integration/api_user_orgs_test.go | 9 | ||||
-rw-r--r-- | tests/integration/user_avatar_test.go | 3 |
6 files changed, 15 insertions, 11 deletions
diff --git a/tests/integration/api_comment_test.go b/tests/integration/api_comment_test.go index cc7712e548..70affc9899 100644 --- a/tests/integration/api_comment_test.go +++ b/tests/integration/api_comment_test.go @@ -128,7 +128,7 @@ func TestAPIGetComment(t *testing.T) { DecodeJSON(t, resp, &apiComment) assert.NoError(t, comment.LoadPoster(db.DefaultContext)) - expect := convert.ToComment(comment) + expect := convert.ToComment(db.DefaultContext, comment) assert.Equal(t, expect.ID, apiComment.ID) assert.Equal(t, expect.Poster.FullName, apiComment.Poster.FullName) diff --git a/tests/integration/api_issue_reaction_test.go b/tests/integration/api_issue_reaction_test.go index 76140d7511..42793c66cf 100644 --- a/tests/integration/api_issue_reaction_test.go +++ b/tests/integration/api_issue_reaction_test.go @@ -65,7 +65,7 @@ func TestAPIIssuesReactions(t *testing.T) { DecodeJSON(t, resp, &apiReactions) expectResponse := make(map[int]api.Reaction) expectResponse[0] = api.Reaction{ - User: convert.ToUser(user2, user2), + User: convert.ToUser(db.DefaultContext, user2, user2), Reaction: "eyes", Created: time.Unix(1573248003, 0), } @@ -125,12 +125,12 @@ func TestAPICommentReactions(t *testing.T) { DecodeJSON(t, resp, &apiReactions) expectResponse := make(map[int]api.Reaction) expectResponse[0] = api.Reaction{ - User: convert.ToUser(user2, user2), + User: convert.ToUser(db.DefaultContext, user2, user2), Reaction: "laugh", Created: time.Unix(1573248004, 0), } expectResponse[1] = api.Reaction{ - User: convert.ToUser(user1, user1), + User: convert.ToUser(db.DefaultContext, user1, user1), Reaction: "laugh", Created: time.Unix(1573248005, 0), } diff --git a/tests/integration/api_team_test.go b/tests/integration/api_team_test.go index 27fe5e12e6..7920513136 100644 --- a/tests/integration/api_team_test.go +++ b/tests/integration/api_team_test.go @@ -10,6 +10,7 @@ import ( "testing" auth_model "code.gitea.io/gitea/models/auth" + "code.gitea.io/gitea/models/db" "code.gitea.io/gitea/models/organization" "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/models/unit" @@ -210,7 +211,7 @@ func checkTeamResponse(t *testing.T, testName string, apiTeam *api.Team, name, d func checkTeamBean(t *testing.T, id int64, name, description string, includesAllRepositories bool, permission string, units []string, unitsMap map[string]string) { team := unittest.AssertExistsAndLoadBean(t, &organization.Team{ID: id}) assert.NoError(t, team.GetUnits(), "GetUnits") - apiTeam, err := convert.ToTeam(team) + apiTeam, err := convert.ToTeam(db.DefaultContext, team) assert.NoError(t, err) checkTeamResponse(t, fmt.Sprintf("checkTeamBean/%s_%s", name, description), apiTeam, name, description, includesAllRepositories, permission, units, unitsMap) } diff --git a/tests/integration/api_team_user_test.go b/tests/integration/api_team_user_test.go index ec977fa572..468697a393 100644 --- a/tests/integration/api_team_user_test.go +++ b/tests/integration/api_team_user_test.go @@ -9,6 +9,7 @@ import ( "time" auth_model "code.gitea.io/gitea/models/auth" + "code.gitea.io/gitea/models/db" "code.gitea.io/gitea/models/unittest" user_model "code.gitea.io/gitea/models/user" api "code.gitea.io/gitea/modules/structs" @@ -34,7 +35,7 @@ func TestAPITeamUser(t *testing.T) { user2.Created = user2.Created.In(time.Local) user := unittest.AssertExistsAndLoadBean(t, &user_model.User{Name: "user2"}) - expectedUser := convert.ToUser(user, user) + expectedUser := convert.ToUser(db.DefaultContext, user, user) // test time via unix timestamp assert.EqualValues(t, expectedUser.LastLogin.Unix(), user2.LastLogin.Unix()) diff --git a/tests/integration/api_user_orgs_test.go b/tests/integration/api_user_orgs_test.go index 831ca018b4..8f914b4875 100644 --- a/tests/integration/api_user_orgs_test.go +++ b/tests/integration/api_user_orgs_test.go @@ -9,6 +9,7 @@ import ( "testing" auth_model "code.gitea.io/gitea/models/auth" + "code.gitea.io/gitea/models/db" "code.gitea.io/gitea/models/unittest" user_model "code.gitea.io/gitea/models/user" api "code.gitea.io/gitea/modules/structs" @@ -35,7 +36,7 @@ func TestUserOrgs(t *testing.T) { Name: user17.Name, UserName: user17.Name, FullName: user17.FullName, - AvatarURL: user17.AvatarLink(), + AvatarURL: user17.AvatarLink(db.DefaultContext), Description: "", Website: "", Location: "", @@ -46,7 +47,7 @@ func TestUserOrgs(t *testing.T) { Name: user3.Name, UserName: user3.Name, FullName: user3.FullName, - AvatarURL: user3.AvatarLink(), + AvatarURL: user3.AvatarLink(db.DefaultContext), Description: "", Website: "", Location: "", @@ -105,7 +106,7 @@ func TestMyOrgs(t *testing.T) { Name: user17.Name, UserName: user17.Name, FullName: user17.FullName, - AvatarURL: user17.AvatarLink(), + AvatarURL: user17.AvatarLink(db.DefaultContext), Description: "", Website: "", Location: "", @@ -116,7 +117,7 @@ func TestMyOrgs(t *testing.T) { Name: user3.Name, UserName: user3.Name, FullName: user3.FullName, - AvatarURL: user3.AvatarLink(), + AvatarURL: user3.AvatarLink(db.DefaultContext), Description: "", Website: "", Location: "", diff --git a/tests/integration/user_avatar_test.go b/tests/integration/user_avatar_test.go index 08ecb8b749..7aeba6a334 100644 --- a/tests/integration/user_avatar_test.go +++ b/tests/integration/user_avatar_test.go @@ -12,6 +12,7 @@ import ( "net/url" "testing" + "code.gitea.io/gitea/models/db" "code.gitea.io/gitea/models/unittest" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/avatar" @@ -73,7 +74,7 @@ func TestUserAvatar(t *testing.T) { user2 = unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}) // owner of the repo3, is an org - req = NewRequest(t, "GET", user2.AvatarLinkWithSize(0)) + req = NewRequest(t, "GET", user2.AvatarLinkWithSize(db.DefaultContext, 0)) _ = session.MakeRequest(t, req, http.StatusOK) // Can't test if the response matches because the image is re-generated on upload but checking that this at least doesn't give a 404 should be enough. |