MCPcopy
hub / github.com/cli/cli / Test_getSecrets_pagination

Function Test_getSecrets_pagination

pkg/cmd/secret/list/list_test.go:845–863  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

843}
844
845func Test_getSecrets_pagination(t *testing.T) {
846 reg := &httpmock.Registry{}
847 defer reg.Verify(t)
848 reg.Register(
849 httpmock.QueryMatcher("GET", "path/to", url.Values{"per_page": []string{"100"}}),
850 httpmock.WithHeader(
851 httpmock.StringResponse(`{"secrets":[{},{}]}`),
852 "Link",
853 `<http://example.com/page/0>; rel="previous", <http://example.com/page/2>; rel="next"`),
854 )
855 reg.Register(
856 httpmock.REST("GET", "page/2"),
857 httpmock.StringResponse(`{"secrets":[{},{}]}`),
858 )
859 client := &http.Client{Transport: reg}
860 secrets, err := getSecrets(client, "github.com", "path/to")
861 assert.NoError(t, err)
862 assert.Equal(t, 4, len(secrets))
863}
864
865func TestExportSecrets(t *testing.T) {
866 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
getSecretsFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected