MCPcopy Index your code
hub / github.com/google/go-github / TestSearchService_Issues_withQualifiersNoOpts

Function TestSearchService_Issues_withQualifiersNoOpts

github/search_test.go:348–384  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

346}
347
348func 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
386func TestSearchService_Issues_withQualifiersAndOpts(t *testing.T) {
387 t.Parallel()

Callers

nothing calls this directly

Calls 6

testMethodFunction · 0.85
testFormValuesFunction · 0.85
IssuesMethod · 0.80
EqualMethod · 0.80
setupFunction · 0.70
PtrFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…