Browse Source

Expand fixtures (#2571)

* Add more repo search tests

* Add and fix /api/repo/search integration tests

* Add owner to access table for organization repositories

* Remove tests
Morlinest 2 years ago
parent
commit
ca68a75b5b

+ 24 - 0
models/fixtures/access.yml

@@ -15,3 +15,27 @@
15 15
   user_id: 4
16 16
   repo_id: 3
17 17
   mode: 2 # write
18
+
19
+-
20
+  id: 4
21
+  user_id: 15
22
+  repo_id: 22
23
+  mode: 2 # write
24
+
25
+-
26
+  id: 5
27
+  user_id: 15
28
+  repo_id: 21
29
+  mode: 2 # write
30
+
31
+-
32
+  id: 6
33
+  user_id: 15
34
+  repo_id: 23
35
+  mode: 4 # owner
36
+
37
+-
38
+  id: 7
39
+  user_id: 15
40
+  repo_id: 24
41
+  mode: 4 # owner

+ 8 - 0
models/fixtures/org_user.yml

@@ -29,3 +29,11 @@
29 29
   is_public: false
30 30
   is_owner: true
31 31
   num_teams: 1
32
+
33
+-
34
+  id: 5
35
+  uid: 15
36
+  org_id: 17
37
+  is_public: true
38
+  is_owner: true
39
+  num_teams: 1

+ 97 - 0
models/fixtures/repository.yml

@@ -188,3 +188,100 @@
188 188
   num_pulls: 0
189 189
   num_closed_pulls: 0
190 190
   num_watches: 0
191
+
192
+-
193
+  id: 17
194
+  owner_id: 15
195
+  lower_name: big_test_public_1
196
+  name: big_test_public_1
197
+  is_private: false
198
+  num_issues: 0
199
+  num_closed_issues: 0
200
+  num_pulls: 0
201
+  num_closed_pulls: 0
202
+  num_watches: 0
203
+  is_mirror: false
204
+
205
+-
206
+  id: 18
207
+  owner_id: 15
208
+  lower_name: big_test_public_2
209
+  name: big_test_public_2
210
+  is_private: false
211
+  num_issues: 0
212
+  num_closed_issues: 0
213
+  num_pulls: 0
214
+  num_closed_pulls: 0
215
+  is_mirror: false
216
+
217
+-
218
+  id: 19
219
+  owner_id: 15
220
+  lower_name: big_test_private_1
221
+  name: big_test_private_1
222
+  is_private: true
223
+  num_issues: 0
224
+  num_closed_issues: 0
225
+  num_pulls: 0
226
+  num_closed_pulls: 0
227
+  is_mirror: false
228
+
229
+-
230
+  id: 20
231
+  owner_id: 15
232
+  lower_name: big_test_private_2
233
+  name: big_test_private_2
234
+  is_private: true
235
+  num_issues: 0
236
+  num_closed_issues: 0
237
+  num_pulls: 0
238
+  num_closed_pulls: 0
239
+  is_mirror: false
240
+
241
+-
242
+  id: 21
243
+  owner_id: 16
244
+  lower_name: big_test_public_3
245
+  name: big_test_public_3
246
+  is_private: false
247
+  num_issues: 0
248
+  num_closed_issues: 0
249
+  num_pulls: 0
250
+  num_closed_pulls: 0
251
+  is_mirror: false
252
+
253
+-
254
+  id: 22
255
+  owner_id: 16
256
+  lower_name: big_test_private_3
257
+  name: big_test_private_3
258
+  is_private: true
259
+  num_issues: 0
260
+  num_closed_issues: 0
261
+  num_pulls: 0
262
+  num_closed_pulls: 0
263
+  is_mirror: false
264
+
265
+-
266
+  id: 23
267
+  owner_id: 17
268
+  lower_name: big_test_public_4
269
+  name: big_test_public_4
270
+  is_private: false
271
+  num_issues: 0
272
+  num_closed_issues: 0
273
+  num_pulls: 0
274
+  num_closed_pulls: 0
275
+  is_mirror: false
276
+
277
+-
278
+  id: 24
279
+  owner_id: 17
280
+  lower_name: big_test_private_4
281
+  name: big_test_private_4
282
+  is_private: true
283
+  num_issues: 0
284
+  num_closed_issues: 0
285
+  num_pulls: 0
286
+  num_closed_pulls: 0
287
+  is_mirror: false

+ 9 - 0
models/fixtures/team.yml

@@ -37,3 +37,12 @@
37 37
   num_repos: 0
38 38
   num_members: 1
39 39
   unit_types: '[1,2,3,4,5,6,7]'
40
+-
41
+  id: 5
42
+  org_id: 17
43
+  lower_name: owners
44
+  name: Owners
45
+  authorize: 4 # owner
46
+  num_repos: 2
47
+  num_members: 1
48
+  unit_types: '[1,2,3,4,5,6,7]'

+ 12 - 0
models/fixtures/team_repo.yml

@@ -15,3 +15,15 @@
15 15
   org_id: 3
16 16
   team_id: 1
17 17
   repo_id: 5
18
+
19
+-
20
+  id: 4
21
+  org_id: 17
22
+  team_id: 5
23
+  repo_id: 23
24
+
25
+-
26
+  id: 5
27
+  org_id: 17
28
+  team_id: 5
29
+  repo_id: 24

+ 6 - 0
models/fixtures/team_user.yml

@@ -27,3 +27,9 @@
27 27
   org_id: 7
28 28
   team_id: 4
29 29
   uid: 5
30
+
31
+-
32
+  id: 6
33
+  org_id: 17
34
+  team_id: 5
35
+  uid: 15

+ 47 - 0
models/fixtures/user.yml

@@ -218,3 +218,50 @@
218 218
   avatar_email: user13@example.com
219 219
   num_repos: 3
220 220
   is_active: true
221
+
222
+-
223
+  id: 15
224
+  lower_name: user15
225
+  name: user15
226
+  full_name: User 15
227
+  email: user15@example.com
228
+  passwd: 7d93daa0d1e6f2305cc8fa496847d61dc7320bb16262f9c55dd753480207234cdd96a93194e408341971742f4701772a025a # password
229
+  type: 0 # individual
230
+  salt: ZogKvWdyEx
231
+  is_admin: false
232
+  avatar: avatar15
233
+  avatar_email: user15@example.com
234
+  num_repos: 4
235
+  is_active: true
236
+
237
+-
238
+  id: 16
239
+  lower_name: user16
240
+  name: user16
241
+  full_name: User 16
242
+  email: user16@example.com
243
+  passwd: 7d93daa0d1e6f2305cc8fa496847d61dc7320bb16262f9c55dd753480207234cdd96a93194e408341971742f4701772a025a # password
244
+  type: 0 # individual
245
+  salt: ZogKvWdyEx
246
+  is_admin: false
247
+  avatar: avatar16
248
+  avatar_email: user16@example.com
249
+  num_repos: 2
250
+  is_active: true
251
+
252
+-
253
+  id: 17
254
+  lower_name: user17
255
+  name: user17
256
+  full_name: User 17
257
+  email: user17@example.com
258
+  passwd: 7d93daa0d1e6f2305cc8fa496847d61dc7320bb16262f9c55dd753480207234cdd96a93194e408341971742f4701772a025a # password
259
+  type: 1 # organization
260
+  salt: ZogKvWdyEx
261
+  is_admin: false
262
+  avatar: avatar17
263
+  avatar_email: user17@example.com
264
+  num_repos: 2
265
+  is_active: true
266
+  num_members: 1
267
+  num_teams: 1

+ 1 - 1
models/org_test.go

@@ -252,7 +252,7 @@ func TestOrganizations(t *testing.T) {
252 252
 		[]int64{3, 6})
253 253
 
254 254
 	testSuccess(&SearchUserOptions{OrderBy: "id ASC", Page: 2, PageSize: 2},
255
-		[]int64{7})
255
+		[]int64{7, 17})
256 256
 
257 257
 	testSuccess(&SearchUserOptions{Page: 3, PageSize: 2},
258 258
 		[]int64{})