(t *testing.T)
| 346 | } |
| 347 | |
| 348 | func TestSearchService_Issues_withQualifiersNoOpts(t *testing.T) { |
| 349 | t.Parallel() |
| 350 | client, mux, _ := setup(t) |
| 351 | |
| 352 | const q = "gopher is:issue label:bug language:c++ pushed:>=2018-01-01 stars:>=200" |
| 353 | |
| 354 | var requestURI string |
| 355 | mux.HandleFunc("/search/issues", func(w http.ResponseWriter, r *http.Request) { |
| 356 | testMethod(t, r, "GET") |
| 357 | testFormValues(t, r, values{ |
| 358 | "q": q, |
| 359 | }) |
| 360 | requestURI = r.RequestURI |
| 361 | |
| 362 | fmt.Fprint(w, `{"total_count": 4, "incomplete_results": true, "items": [{"number":1},{"number":2}]}`) |
| 363 | }) |
| 364 | |
| 365 | opts := &SearchOptions{} |
| 366 | ctx := t.Context() |
| 367 | result, _, err := client.Search.Issues(ctx, q, opts) |
| 368 | if err != nil { |
| 369 | t.Errorf("Search.Issues returned error: %v", err) |
| 370 | } |
| 371 | |
| 372 | if want := "/api-v3/search/issues?q=gopher+is%3Aissue+label%3Abug+language%3Ac%2B%2B+pushed%3A%3E%3D2018-01-01+stars%3A%3E%3D200"; requestURI != want { |
| 373 | t.Fatalf("URI encoding failed: got %v, want %v", requestURI, want) |
| 374 | } |
| 375 | |
| 376 | want := &IssuesSearchResult{ |
| 377 | Total: Ptr(4), |
| 378 | IncompleteResults: Ptr(true), |
| 379 | Issues: []*Issue{{Number: Ptr(1)}, {Number: Ptr(2)}}, |
| 380 | } |
| 381 | if !cmp.Equal(result, want) { |
| 382 | t.Errorf("Search.Issues returned %+v, want %+v", result, want) |
| 383 | } |
| 384 | } |
| 385 | |
| 386 | func TestSearchService_Issues_withQualifiersAndOpts(t *testing.T) { |
| 387 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…