@@ -88,7 +88,7 @@ func TestCanCreateOrganization(t *testing.T) {
88
88
89
89
func TestSearchUsers (t * testing.T ) {
90
90
assert .NoError (t , unittest .PrepareTestDatabase ())
91
- testSuccess := func (opts * user_model.SearchUserOptions , expectedUserOrOrgIDs []int64 ) {
91
+ testSuccess := func (opts user_model.SearchUserOptions , expectedUserOrOrgIDs []int64 ) {
92
92
users , _ , err := user_model .SearchUsers (db .DefaultContext , opts )
93
93
assert .NoError (t , err )
94
94
cassText := fmt .Sprintf ("ids: %v, opts: %v" , expectedUserOrOrgIDs , opts )
@@ -100,61 +100,61 @@ func TestSearchUsers(t *testing.T) {
100
100
}
101
101
102
102
// test orgs
103
- testOrgSuccess := func (opts * user_model.SearchUserOptions , expectedOrgIDs []int64 ) {
103
+ testOrgSuccess := func (opts user_model.SearchUserOptions , expectedOrgIDs []int64 ) {
104
104
opts .Type = user_model .UserTypeOrganization
105
105
testSuccess (opts , expectedOrgIDs )
106
106
}
107
107
108
- testOrgSuccess (& user_model.SearchUserOptions {OrderBy : "id ASC" , ListOptions : db.ListOptions {Page : 1 , PageSize : 2 }},
108
+ testOrgSuccess (user_model.SearchUserOptions {OrderBy : "id ASC" , ListOptions : db.ListOptions {Page : 1 , PageSize : 2 }},
109
109
[]int64 {3 , 6 })
110
110
111
- testOrgSuccess (& user_model.SearchUserOptions {OrderBy : "id ASC" , ListOptions : db.ListOptions {Page : 2 , PageSize : 2 }},
111
+ testOrgSuccess (user_model.SearchUserOptions {OrderBy : "id ASC" , ListOptions : db.ListOptions {Page : 2 , PageSize : 2 }},
112
112
[]int64 {7 , 17 })
113
113
114
- testOrgSuccess (& user_model.SearchUserOptions {OrderBy : "id ASC" , ListOptions : db.ListOptions {Page : 3 , PageSize : 2 }},
114
+ testOrgSuccess (user_model.SearchUserOptions {OrderBy : "id ASC" , ListOptions : db.ListOptions {Page : 3 , PageSize : 2 }},
115
115
[]int64 {19 , 25 })
116
116
117
- testOrgSuccess (& user_model.SearchUserOptions {OrderBy : "id ASC" , ListOptions : db.ListOptions {Page : 4 , PageSize : 2 }},
117
+ testOrgSuccess (user_model.SearchUserOptions {OrderBy : "id ASC" , ListOptions : db.ListOptions {Page : 4 , PageSize : 2 }},
118
118
[]int64 {26 , 41 })
119
119
120
- testOrgSuccess (& user_model.SearchUserOptions {OrderBy : "id ASC" , ListOptions : db.ListOptions {Page : 5 , PageSize : 2 }},
120
+ testOrgSuccess (user_model.SearchUserOptions {OrderBy : "id ASC" , ListOptions : db.ListOptions {Page : 5 , PageSize : 2 }},
121
121
[]int64 {42 })
122
122
123
- testOrgSuccess (& user_model.SearchUserOptions {ListOptions : db.ListOptions {Page : 6 , PageSize : 2 }},
123
+ testOrgSuccess (user_model.SearchUserOptions {ListOptions : db.ListOptions {Page : 6 , PageSize : 2 }},
124
124
[]int64 {})
125
125
126
126
// test users
127
- testUserSuccess := func (opts * user_model.SearchUserOptions , expectedUserIDs []int64 ) {
127
+ testUserSuccess := func (opts user_model.SearchUserOptions , expectedUserIDs []int64 ) {
128
128
opts .Type = user_model .UserTypeIndividual
129
129
testSuccess (opts , expectedUserIDs )
130
130
}
131
131
132
- testUserSuccess (& user_model.SearchUserOptions {OrderBy : "id ASC" , ListOptions : db.ListOptions {Page : 1 }},
132
+ testUserSuccess (user_model.SearchUserOptions {OrderBy : "id ASC" , ListOptions : db.ListOptions {Page : 1 }},
133
133
[]int64 {1 , 2 , 4 , 5 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 18 , 20 , 21 , 24 , 27 , 28 , 29 , 30 , 32 , 34 , 37 , 38 , 39 , 40 })
134
134
135
- testUserSuccess (& user_model.SearchUserOptions {ListOptions : db.ListOptions {Page : 1 }, IsActive : optional .Some (false )},
135
+ testUserSuccess (user_model.SearchUserOptions {ListOptions : db.ListOptions {Page : 1 }, IsActive : optional .Some (false )},
136
136
[]int64 {9 })
137
137
138
- testUserSuccess (& user_model.SearchUserOptions {OrderBy : "id ASC" , ListOptions : db.ListOptions {Page : 1 }, IsActive : optional .Some (true )},
138
+ testUserSuccess (user_model.SearchUserOptions {OrderBy : "id ASC" , ListOptions : db.ListOptions {Page : 1 }, IsActive : optional .Some (true )},
139
139
[]int64 {1 , 2 , 4 , 5 , 8 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 18 , 20 , 21 , 24 , 27 , 28 , 29 , 30 , 32 , 34 , 37 , 38 , 39 , 40 })
140
140
141
- testUserSuccess (& user_model.SearchUserOptions {Keyword : "user1" , OrderBy : "id ASC" , ListOptions : db.ListOptions {Page : 1 }, IsActive : optional .Some (true )},
141
+ testUserSuccess (user_model.SearchUserOptions {Keyword : "user1" , OrderBy : "id ASC" , ListOptions : db.ListOptions {Page : 1 }, IsActive : optional .Some (true )},
142
142
[]int64 {1 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 18 })
143
143
144
144
// order by name asc default
145
- testUserSuccess (& user_model.SearchUserOptions {Keyword : "user1" , ListOptions : db.ListOptions {Page : 1 }, IsActive : optional .Some (true )},
145
+ testUserSuccess (user_model.SearchUserOptions {Keyword : "user1" , ListOptions : db.ListOptions {Page : 1 }, IsActive : optional .Some (true )},
146
146
[]int64 {1 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 18 })
147
147
148
- testUserSuccess (& user_model.SearchUserOptions {ListOptions : db.ListOptions {Page : 1 }, IsAdmin : optional .Some (true )},
148
+ testUserSuccess (user_model.SearchUserOptions {ListOptions : db.ListOptions {Page : 1 }, IsAdmin : optional .Some (true )},
149
149
[]int64 {1 })
150
150
151
- testUserSuccess (& user_model.SearchUserOptions {ListOptions : db.ListOptions {Page : 1 }, IsRestricted : optional .Some (true )},
151
+ testUserSuccess (user_model.SearchUserOptions {ListOptions : db.ListOptions {Page : 1 }, IsRestricted : optional .Some (true )},
152
152
[]int64 {29 })
153
153
154
- testUserSuccess (& user_model.SearchUserOptions {ListOptions : db.ListOptions {Page : 1 }, IsProhibitLogin : optional .Some (true )},
154
+ testUserSuccess (user_model.SearchUserOptions {ListOptions : db.ListOptions {Page : 1 }, IsProhibitLogin : optional .Some (true )},
155
155
[]int64 {37 })
156
156
157
- testUserSuccess (& user_model.SearchUserOptions {ListOptions : db.ListOptions {Page : 1 }, IsTwoFactorEnabled : optional .Some (true )},
157
+ testUserSuccess (user_model.SearchUserOptions {ListOptions : db.ListOptions {Page : 1 }, IsTwoFactorEnabled : optional .Some (true )},
158
158
[]int64 {24 })
159
159
}
160
160
0 commit comments