MCPcopy Create free account
hub / github.com/cli/cli / Test_getVariables_pagination

Function Test_getVariables_pagination

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected