diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-11-22 21:51:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-22 21:51:45 +0800 |
commit | c2ab19888f92fbdec4276a16d224e8de80d1d1dd (patch) | |
tree | 1fdbf05d1b6d2a99e88e8219133a252fce6562d5 /models/org_test.go | |
parent | ed23a6c39704c329ec4940bfec16739a0d3d3e91 (diff) | |
download | gitea-c2ab19888f92fbdec4276a16d224e8de80d1d1dd.tar.gz gitea-c2ab19888f92fbdec4276a16d224e8de80d1d1dd.zip |
Support pagination of organizations on user settings pages (#16083)
* Add pagination for user setting orgs
* Use FindOrgs instead of GetOrgsByUserID
* Remove unnecessary functions and fix test
* remove unnecessary code
Diffstat (limited to 'models/org_test.go')
-rw-r--r-- | models/org_test.go | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/models/org_test.go b/models/org_test.go index 10ae877458..805c63300b 100644 --- a/models/org_test.go +++ b/models/org_test.go @@ -307,18 +307,31 @@ func TestIsPublicMembership(t *testing.T) { test(unittest.NonexistentID, unittest.NonexistentID, false) } -func TestGetOrgsByUserID(t *testing.T) { +func TestFindOrgs(t *testing.T) { assert.NoError(t, unittest.PrepareTestDatabase()) - orgs, err := GetOrgsByUserID(4, true) + orgs, err := FindOrgs(FindOrgOptions{ + UserID: 4, + IncludePrivate: true, + }) assert.NoError(t, err) if assert.Len(t, orgs, 1) { assert.EqualValues(t, 3, orgs[0].ID) } - orgs, err = GetOrgsByUserID(4, false) + orgs, err = FindOrgs(FindOrgOptions{ + UserID: 4, + IncludePrivate: false, + }) assert.NoError(t, err) assert.Len(t, orgs, 0) + + total, err := CountOrgs(FindOrgOptions{ + UserID: 4, + IncludePrivate: true, + }) + assert.NoError(t, err) + assert.EqualValues(t, 1, total) } func TestGetOwnedOrgsByUserID(t *testing.T) { |