forked from forgejo/forgejo
Add search mode option to /api/repo/search (#2756)
* Add repo type option to /api/repo/search * Add tests and fix result of collaborative filter in specific condition * Fix/optimize search & tests * Improve integration tests * Fix lint errors * Fix unit tests * Change and improve internal implementation of repo search * Use NonexistentID * Make search api more general * Change mirror and fork search behaviour * Fix tests & typo in comment
This commit is contained in:
parent
4d01ecaef3
commit
ddb7f59ef4
16 changed files with 502 additions and 139 deletions
|
@ -63,7 +63,10 @@ func TestSearchUsers(t *testing.T) {
|
|||
testOrgSuccess(&SearchUserOptions{OrderBy: "id ASC", Page: 2, PageSize: 2},
|
||||
[]int64{7, 17})
|
||||
|
||||
testOrgSuccess(&SearchUserOptions{Page: 3, PageSize: 2},
|
||||
testOrgSuccess(&SearchUserOptions{OrderBy: "id ASC", Page: 3, PageSize: 2},
|
||||
[]int64{19})
|
||||
|
||||
testOrgSuccess(&SearchUserOptions{Page: 4, PageSize: 2},
|
||||
[]int64{})
|
||||
|
||||
// test users
|
||||
|
@ -73,13 +76,13 @@ func TestSearchUsers(t *testing.T) {
|
|||
}
|
||||
|
||||
testUserSuccess(&SearchUserOptions{OrderBy: "id ASC", Page: 1},
|
||||
[]int64{1, 2, 4, 5, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18})
|
||||
[]int64{1, 2, 4, 5, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20})
|
||||
|
||||
testUserSuccess(&SearchUserOptions{Page: 1, IsActive: util.OptionalBoolFalse},
|
||||
[]int64{9})
|
||||
|
||||
testUserSuccess(&SearchUserOptions{OrderBy: "id ASC", Page: 1, IsActive: util.OptionalBoolTrue},
|
||||
[]int64{1, 2, 4, 5, 8, 10, 11, 12, 13, 14, 15, 16, 18})
|
||||
[]int64{1, 2, 4, 5, 8, 10, 11, 12, 13, 14, 15, 16, 18, 20})
|
||||
|
||||
testUserSuccess(&SearchUserOptions{Keyword: "user1", OrderBy: "id ASC", Page: 1, IsActive: util.OptionalBoolTrue},
|
||||
[]int64{1, 10, 11, 12, 13, 14, 15, 16, 18})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue