Skip to content

Commit 709aa56

Browse files
committed
fix test
1 parent 485acf9 commit 709aa56

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

integrations/issue_test.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -448,43 +448,45 @@ func TestSearchIssues(t *testing.T) {
448448
func TestSearchIssuesWithLabels(t *testing.T) {
449449
defer prepareTestEnv(t)()
450450

451-
session := loginUser(t, "user1")
451+
token := getUserToken(t, "user1")
452452

453-
link, _ := url.Parse("/api/v1/repos/issues/search")
453+
link, _ := url.Parse("/api/v1/repos/issues/search?token=" + token)
454454
req := NewRequest(t, "GET", link.String())
455-
resp := session.MakeRequest(t, req, http.StatusOK)
455+
resp := MakeRequest(t, req, http.StatusOK)
456456
var apiIssues []*api.Issue
457457
DecodeJSON(t, resp, &apiIssues)
458458

459459
assert.Len(t, apiIssues, 10)
460460

461-
query := url.Values{}
461+
query := url.Values{
462+
"token": []string{token},
463+
}
462464
link.RawQuery = query.Encode()
463465
req = NewRequest(t, "GET", link.String())
464-
resp = session.MakeRequest(t, req, http.StatusOK)
466+
resp = MakeRequest(t, req, http.StatusOK)
465467
DecodeJSON(t, resp, &apiIssues)
466468
assert.Len(t, apiIssues, 10)
467469

468470
query.Add("labels", "label1")
469471
link.RawQuery = query.Encode()
470472
req = NewRequest(t, "GET", link.String())
471-
resp = session.MakeRequest(t, req, http.StatusOK)
473+
resp = MakeRequest(t, req, http.StatusOK)
472474
DecodeJSON(t, resp, &apiIssues)
473475
assert.Len(t, apiIssues, 2)
474476

475477
// multiple labels
476478
query.Set("labels", "label1,label2")
477479
link.RawQuery = query.Encode()
478480
req = NewRequest(t, "GET", link.String())
479-
resp = session.MakeRequest(t, req, http.StatusOK)
481+
resp = MakeRequest(t, req, http.StatusOK)
480482
DecodeJSON(t, resp, &apiIssues)
481483
assert.Len(t, apiIssues, 2)
482484

483485
// an org label
484486
query.Set("labels", "orglabel4")
485487
link.RawQuery = query.Encode()
486488
req = NewRequest(t, "GET", link.String())
487-
resp = session.MakeRequest(t, req, http.StatusOK)
489+
resp = MakeRequest(t, req, http.StatusOK)
488490
DecodeJSON(t, resp, &apiIssues)
489491
assert.Len(t, apiIssues, 1)
490492

@@ -493,15 +495,15 @@ func TestSearchIssuesWithLabels(t *testing.T) {
493495
query.Add("state", "all")
494496
link.RawQuery = query.Encode()
495497
req = NewRequest(t, "GET", link.String())
496-
resp = session.MakeRequest(t, req, http.StatusOK)
498+
resp = MakeRequest(t, req, http.StatusOK)
497499
DecodeJSON(t, resp, &apiIssues)
498500
assert.Len(t, apiIssues, 2)
499501

500502
// org and repo label which share the same issue
501503
query.Set("labels", "label1,orglabel4")
502504
link.RawQuery = query.Encode()
503505
req = NewRequest(t, "GET", link.String())
504-
resp = session.MakeRequest(t, req, http.StatusOK)
506+
resp = MakeRequest(t, req, http.StatusOK)
505507
DecodeJSON(t, resp, &apiIssues)
506508
assert.Len(t, apiIssues, 2)
507509
}

0 commit comments

Comments
 (0)