@@ -448,43 +448,45 @@ func TestSearchIssues(t *testing.T) {
448
448
func TestSearchIssuesWithLabels (t * testing.T ) {
449
449
defer prepareTestEnv (t )()
450
450
451
- session := loginUser (t , "user1" )
451
+ token := getUserToken (t , "user1" )
452
452
453
- link , _ := url .Parse ("/api/v1/repos/issues/search" )
453
+ link , _ := url .Parse ("/api/v1/repos/issues/search?token=" + token )
454
454
req := NewRequest (t , "GET" , link .String ())
455
- resp := session . MakeRequest (t , req , http .StatusOK )
455
+ resp := MakeRequest (t , req , http .StatusOK )
456
456
var apiIssues []* api.Issue
457
457
DecodeJSON (t , resp , & apiIssues )
458
458
459
459
assert .Len (t , apiIssues , 10 )
460
460
461
- query := url.Values {}
461
+ query := url.Values {
462
+ "token" : []string {token },
463
+ }
462
464
link .RawQuery = query .Encode ()
463
465
req = NewRequest (t , "GET" , link .String ())
464
- resp = session . MakeRequest (t , req , http .StatusOK )
466
+ resp = MakeRequest (t , req , http .StatusOK )
465
467
DecodeJSON (t , resp , & apiIssues )
466
468
assert .Len (t , apiIssues , 10 )
467
469
468
470
query .Add ("labels" , "label1" )
469
471
link .RawQuery = query .Encode ()
470
472
req = NewRequest (t , "GET" , link .String ())
471
- resp = session . MakeRequest (t , req , http .StatusOK )
473
+ resp = MakeRequest (t , req , http .StatusOK )
472
474
DecodeJSON (t , resp , & apiIssues )
473
475
assert .Len (t , apiIssues , 2 )
474
476
475
477
// multiple labels
476
478
query .Set ("labels" , "label1,label2" )
477
479
link .RawQuery = query .Encode ()
478
480
req = NewRequest (t , "GET" , link .String ())
479
- resp = session . MakeRequest (t , req , http .StatusOK )
481
+ resp = MakeRequest (t , req , http .StatusOK )
480
482
DecodeJSON (t , resp , & apiIssues )
481
483
assert .Len (t , apiIssues , 2 )
482
484
483
485
// an org label
484
486
query .Set ("labels" , "orglabel4" )
485
487
link .RawQuery = query .Encode ()
486
488
req = NewRequest (t , "GET" , link .String ())
487
- resp = session . MakeRequest (t , req , http .StatusOK )
489
+ resp = MakeRequest (t , req , http .StatusOK )
488
490
DecodeJSON (t , resp , & apiIssues )
489
491
assert .Len (t , apiIssues , 1 )
490
492
@@ -493,15 +495,15 @@ func TestSearchIssuesWithLabels(t *testing.T) {
493
495
query .Add ("state" , "all" )
494
496
link .RawQuery = query .Encode ()
495
497
req = NewRequest (t , "GET" , link .String ())
496
- resp = session . MakeRequest (t , req , http .StatusOK )
498
+ resp = MakeRequest (t , req , http .StatusOK )
497
499
DecodeJSON (t , resp , & apiIssues )
498
500
assert .Len (t , apiIssues , 2 )
499
501
500
502
// org and repo label which share the same issue
501
503
query .Set ("labels" , "label1,orglabel4" )
502
504
link .RawQuery = query .Encode ()
503
505
req = NewRequest (t , "GET" , link .String ())
504
- resp = session . MakeRequest (t , req , http .StatusOK )
506
+ resp = MakeRequest (t , req , http .StatusOK )
505
507
DecodeJSON (t , resp , & apiIssues )
506
508
assert .Len (t , apiIssues , 2 )
507
509
}
0 commit comments