mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-05 12:29:05 +02:00
Merge remote-tracking branch 'upstream/main' into limit-repo-size
This commit is contained in:
commit
920fb5889f
185 files changed
+1502
-995
No files matched your search
@@ -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)
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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: "",
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user