diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-12-29 21:02:12 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-29 21:02:12 +0800 |
commit | 8ce1b539b1aaf242903b5b0c342dd592bd8da8d9 (patch) | |
tree | 455d363b51d69a9be4058961a16d5c43b7698f47 /models/user_test.go | |
parent | 8fa97a25f0dccc4db94d344ce7af632f8fe358b0 (diff) | |
download | gitea-8ce1b539b1aaf242903b5b0c342dd592bd8da8d9.tar.gz gitea-8ce1b539b1aaf242903b5b0c342dd592bd8da8d9.zip |
Use conditions but not repo ids as query condition (#16839)
* Use conditions but not repo ids as query condition
* Improve the performance of pulls/issue
* Remove duplicated code
* fix lint
* Fix bug
* Fix stats
* More fixes
* Fix build
* Fix lint
* Fix test
* Fix build
* Adjust the logic
* Merge
* Fix conflicts
* improve the performance
* Add comments for the query conditions functions
* Some improvements
Diffstat (limited to 'models/user_test.go')
-rw-r--r-- | models/user_test.go | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/models/user_test.go b/models/user_test.go index 4749a3af73..83201ff4cb 100644 --- a/models/user_test.go +++ b/models/user_test.go @@ -98,25 +98,3 @@ func testIsUserOrgOwner(t *testing.T, uid, orgID int64, expected bool) { assert.NoError(t, err) assert.Equal(t, expected, is) } - -func TestGetOrgRepositoryIDs(t *testing.T) { - assert.NoError(t, unittest.PrepareTestDatabase()) - user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}).(*user_model.User) - user4 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 4}).(*user_model.User) - user5 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 5}).(*user_model.User) - - accessibleRepos, err := GetOrgRepositoryIDs(user2) - assert.NoError(t, err) - // User 2's team has access to private repos 3, 5, repo 32 is a public repo of the organization - assert.Equal(t, []int64{3, 5, 23, 24, 32}, accessibleRepos) - - accessibleRepos, err = GetOrgRepositoryIDs(user4) - assert.NoError(t, err) - // User 4's team has access to private repo 3, repo 32 is a public repo of the organization - assert.Equal(t, []int64{3, 32}, accessibleRepos) - - accessibleRepos, err = GetOrgRepositoryIDs(user5) - assert.NoError(t, err) - // User 5's team has no access to any repo - assert.Len(t, accessibleRepos, 0) -} |