@@ -19,14 +19,15 @@ import (
1919 _ "code.gitea.io/gitea/models/activities"
2020
2121 "github.com/stretchr/testify/assert"
22+ "github.com/stretchr/testify/require"
2223)
2324
2425func TestMain (m * testing.M ) {
2526 unittest .MainTest (m )
2627}
2728
2829func TestDBSearchIssues (t * testing.T ) {
29- assert .NoError (t , unittest .PrepareTestDatabase ())
30+ require .NoError (t , unittest .PrepareTestDatabase ())
3031
3132 setting .Indexer .IssueType = "db"
3233 InitIssueIndexer (true )
@@ -83,9 +84,7 @@ func searchIssueWithKeyword(t *testing.T) {
8384
8485 for _ , test := range tests {
8586 issueIDs , _ , err := SearchIssues (context .TODO (), & test .opts )
86- if ! assert .NoError (t , err ) {
87- return
88- }
87+ require .NoError (t , err )
8988 assert .Equal (t , test .expectedIDs , issueIDs )
9089 }
9190}
@@ -120,9 +119,7 @@ func searchIssueByIndex(t *testing.T) {
120119
121120 for _ , test := range tests {
122121 issueIDs , _ , err := SearchIssues (context .TODO (), & test .opts )
123- if ! assert .NoError (t , err ) {
124- return
125- }
122+ require .NoError (t , err )
126123 assert .Equal (t , test .expectedIDs , issueIDs )
127124 }
128125}
@@ -166,9 +163,7 @@ func searchIssueInRepo(t *testing.T) {
166163
167164 for _ , test := range tests {
168165 issueIDs , _ , err := SearchIssues (context .TODO (), & test .opts )
169- if ! assert .NoError (t , err ) {
170- return
171- }
166+ require .NoError (t , err )
172167 assert .Equal (t , test .expectedIDs , issueIDs )
173168 }
174169}
@@ -238,9 +233,7 @@ func searchIssueByID(t *testing.T) {
238233
239234 for _ , test := range tests {
240235 issueIDs , _ , err := SearchIssues (context .TODO (), & test .opts )
241- if ! assert .NoError (t , err ) {
242- return
243- }
236+ require .NoError (t , err )
244237 assert .Equal (t , test .expectedIDs , issueIDs )
245238 }
246239}
@@ -265,9 +258,7 @@ func searchIssueIsPull(t *testing.T) {
265258 }
266259 for _ , test := range tests {
267260 issueIDs , _ , err := SearchIssues (context .TODO (), & test .opts )
268- if ! assert .NoError (t , err ) {
269- return
270- }
261+ require .NoError (t , err )
271262 assert .Equal (t , test .expectedIDs , issueIDs )
272263 }
273264}
@@ -292,9 +283,7 @@ func searchIssueIsClosed(t *testing.T) {
292283 }
293284 for _ , test := range tests {
294285 issueIDs , _ , err := SearchIssues (context .TODO (), & test .opts )
295- if ! assert .NoError (t , err ) {
296- return
297- }
286+ require .NoError (t , err )
298287 assert .Equal (t , test .expectedIDs , issueIDs )
299288 }
300289}
@@ -319,9 +308,7 @@ func searchIssueIsArchived(t *testing.T) {
319308 }
320309 for _ , test := range tests {
321310 issueIDs , _ , err := SearchIssues (context .TODO (), & test .opts )
322- if ! assert .NoError (t , err ) {
323- return
324- }
311+ require .NoError (t , err )
325312 assert .Equal (t , test .expectedIDs , issueIDs )
326313 }
327314}
@@ -346,9 +333,7 @@ func searchIssueByMilestoneID(t *testing.T) {
346333 }
347334 for _ , test := range tests {
348335 issueIDs , _ , err := SearchIssues (context .TODO (), & test .opts )
349- if ! assert .NoError (t , err ) {
350- return
351- }
336+ require .NoError (t , err )
352337 assert .Equal (t , test .expectedIDs , issueIDs )
353338 }
354339}
@@ -379,9 +364,7 @@ func searchIssueByLabelID(t *testing.T) {
379364 }
380365 for _ , test := range tests {
381366 issueIDs , _ , err := SearchIssues (context .TODO (), & test .opts )
382- if ! assert .NoError (t , err ) {
383- return
384- }
367+ require .NoError (t , err )
385368 assert .Equal (t , test .expectedIDs , issueIDs )
386369 }
387370}
@@ -400,9 +383,7 @@ func searchIssueByTime(t *testing.T) {
400383 }
401384 for _ , test := range tests {
402385 issueIDs , _ , err := SearchIssues (context .TODO (), & test .opts )
403- if ! assert .NoError (t , err ) {
404- return
405- }
386+ require .NoError (t , err )
406387 assert .Equal (t , test .expectedIDs , issueIDs )
407388 }
408389}
@@ -421,9 +402,7 @@ func searchIssueWithOrder(t *testing.T) {
421402 }
422403 for _ , test := range tests {
423404 issueIDs , _ , err := SearchIssues (context .TODO (), & test .opts )
424- if ! assert .NoError (t , err ) {
425- return
426- }
405+ require .NoError (t , err )
427406 assert .Equal (t , test .expectedIDs , issueIDs )
428407 }
429408}
@@ -454,9 +433,7 @@ func searchIssueInProject(t *testing.T) {
454433 }
455434 for _ , test := range tests {
456435 issueIDs , _ , err := SearchIssues (context .TODO (), & test .opts )
457- if ! assert .NoError (t , err ) {
458- return
459- }
436+ require .NoError (t , err )
460437 assert .Equal (t , test .expectedIDs , issueIDs )
461438 }
462439}
@@ -479,9 +456,7 @@ func searchIssueWithPaginator(t *testing.T) {
479456 }
480457 for _ , test := range tests {
481458 issueIDs , total , err := SearchIssues (context .TODO (), & test .opts )
482- if ! assert .NoError (t , err ) {
483- return
484- }
459+ require .NoError (t , err )
485460 assert .Equal (t , test .expectedIDs , issueIDs )
486461 assert .Equal (t , test .expectedTotal , total )
487462 }
0 commit comments