mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 10:18:38 +00:00
Hide unactive on explore users and some refactors (#2741)
* hide unactive on explore users and some refactors * fix test for removed Organizations * fix test for removed Organizations * fix imports * fix logic bug * refactor the toConds * Rename TestOrganizations to TestSearchUsers and add tests for users * fix other tests * fix other tests * fix watchers tests * fix comments and remove unused code
This commit is contained in:
@@ -237,27 +237,6 @@ func TestCountOrganizations(t *testing.T) {
|
||||
assert.Equal(t, expected, CountOrganizations())
|
||||
}
|
||||
|
||||
func TestOrganizations(t *testing.T) {
|
||||
assert.NoError(t, PrepareTestDatabase())
|
||||
testSuccess := func(opts *SearchUserOptions, expectedOrgIDs []int64) {
|
||||
orgs, err := Organizations(opts)
|
||||
assert.NoError(t, err)
|
||||
if assert.Len(t, orgs, len(expectedOrgIDs)) {
|
||||
for i, expectedOrgID := range expectedOrgIDs {
|
||||
assert.EqualValues(t, expectedOrgID, orgs[i].ID)
|
||||
}
|
||||
}
|
||||
}
|
||||
testSuccess(&SearchUserOptions{OrderBy: "id ASC", Page: 1, PageSize: 2},
|
||||
[]int64{3, 6})
|
||||
|
||||
testSuccess(&SearchUserOptions{OrderBy: "id ASC", Page: 2, PageSize: 2},
|
||||
[]int64{7, 17})
|
||||
|
||||
testSuccess(&SearchUserOptions{Page: 3, PageSize: 2},
|
||||
[]int64{})
|
||||
}
|
||||
|
||||
func TestDeleteOrganization(t *testing.T) {
|
||||
assert.NoError(t, PrepareTestDatabase())
|
||||
org := AssertExistsAndLoadBean(t, &User{ID: 6}).(*User)
|
||||
|
Reference in New Issue
Block a user