MCPcopy
hub / github.com/cli/cli / Test_getVariables_pagination

Function Test_getVariables_pagination

pkg/cmd/variable/list/list_test.go:424–442  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

422}
423
424func Test_getVariables_pagination(t *testing.T) {
425 reg := &httpmock.Registry{}
426 defer reg.Verify(t)
427 reg.Register(
428 httpmock.QueryMatcher("GET", "path/to", url.Values{"per_page": []string{"100"}}),
429 httpmock.WithHeader(
430 httpmock.StringResponse(`{"variables":[{},{}]}`),
431 "Link",
432 `<http://example.com/page/0>; rel="previous", <http://example.com/page/2>; rel="next"`),
433 )
434 reg.Register(
435 httpmock.REST("GET", "page/2"),
436 httpmock.StringResponse(`{"variables":[{},{}]}`),
437 )
438 client := &http.Client{Transport: reg}
439 variables, err := getVariables(client, "github.com", "path/to")
440 assert.NoError(t, err)
441 assert.Equal(t, 4, len(variables))
442}
443
444func TestExportVariables(t *testing.T) {
445 ios, _, stdout, _ := iostreams.Test()

Callers

nothing calls this directly

Calls 8

VerifyMethod · 0.95
RegisterMethod · 0.95
QueryMatcherFunction · 0.92
WithHeaderFunction · 0.92
StringResponseFunction · 0.92
RESTFunction · 0.92
getVariablesFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected