summaryrefslogtreecommitdiffstats
path: root/integrations/api_repo_test.go
diff options
context:
space:
mode:
authorCirno the Strongest <1447794+CirnoT@users.noreply.github.com>2020-06-09 04:46:51 +0200
committerGitHub <noreply@github.com>2020-06-08 22:46:51 -0400
commitcefbf73aea912c510a8dd194532233076b822d37 (patch)
treee75a011b7563a27e572f4f93670367589fea09fd /integrations/api_repo_test.go
parent5734524378f9388b7a7466445b0b339e2837a5d8 (diff)
downloadgitea-cefbf73aea912c510a8dd194532233076b822d37.tar.gz
gitea-cefbf73aea912c510a8dd194532233076b822d37.zip
Honor DEFAULT_PAGING_NUM for API (#11805)
* Honor DEFAULT_PAGING_NUM for API * set pagination to 10 for tests * lint Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'integrations/api_repo_test.go')
-rw-r--r--integrations/api_repo_test.go9
1 files changed, 8 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}},