diff options
Diffstat (limited to 'integrations')
-rw-r--r-- | integrations/api_repo_test.go | 9 | ||||
-rw-r--r-- | integrations/release_test.go | 7 |
2 files changed, 15 insertions, 1 deletions
diff --git a/integrations/api_repo_test.go b/integrations/api_repo_test.go index d57e5daaf3..7797b8f498 100644 --- a/integrations/api_repo_test.go +++ b/integrations/api_repo_test.go @@ -13,6 +13,7 @@ import ( "testing" "code.gitea.io/gitea/models" + "code.gitea.io/gitea/modules/setting" api "code.gitea.io/gitea/modules/structs" "github.com/stretchr/testify/assert" @@ -57,6 +58,12 @@ func TestAPISearchRepo(t *testing.T) { user4 := models.AssertExistsAndLoadBean(t, &models.User{ID: 20}).(*models.User) orgUser := models.AssertExistsAndLoadBean(t, &models.User{ID: 17}).(*models.User) + oldAPIDefaultNum := setting.API.DefaultPagingNum + defer func() { + setting.API.DefaultPagingNum = oldAPIDefaultNum + }() + setting.API.DefaultPagingNum = 10 + // Map of expected results, where key is user for login type expectedResults map[*models.User]struct { count int @@ -79,7 +86,7 @@ func TestAPISearchRepo(t *testing.T) { user: {count: 10}, user2: {count: 10}}, }, - {name: "RepositoriesDefaultMax10", requestURL: "/api/v1/repos/search?default&private=false", expectedResults: expectedResults{ + {name: "RepositoriesDefault", requestURL: "/api/v1/repos/search?default&private=false", expectedResults: expectedResults{ nil: {count: 10}, user: {count: 10}, user2: {count: 10}}, diff --git a/integrations/release_test.go b/integrations/release_test.go index 176f83d55a..4d2260d884 100644 --- a/integrations/release_test.go +++ b/integrations/release_test.go @@ -10,6 +10,7 @@ import ( "testing" "time" + "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/test" "github.com/stretchr/testify/assert" @@ -106,6 +107,12 @@ func TestCreateReleaseDraft(t *testing.T) { func TestCreateReleasePaging(t *testing.T) { defer prepareTestEnv(t)() + oldAPIDefaultNum := setting.API.DefaultPagingNum + defer func() { + setting.API.DefaultPagingNum = oldAPIDefaultNum + }() + setting.API.DefaultPagingNum = 10 + session := loginUser(t, "user2") // Create enaugh releases to have paging for i := 0; i < 12; i++ { |