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

Function Test_userKeysForUser

pkg/cmd/gpg-key/list/list_test.go:55–68  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

53}
54
55func Test_userKeysForUser(t *testing.T) {
56 reg := &httpmock.Registry{}
57 defer reg.Verify(t)
58 reg.Register(
59 httpmock.QueryMatcher("GET", "users/monalisa/gpg_keys", url.Values{"per_page": []string{"100"}}),
60 httpmock.StringResponse(`[{"key_id":"ABC123"}]`),
61 )
62
63 keys, err := userKeys(&http.Client{Transport: reg}, "github.com", "monalisa")
64
65 require.NoError(t, err)
66 require.Len(t, keys, 1)
67 assert.Equal(t, "ABC123", keys[0].KeyID)
68}
69
70func Test_listRun(t *testing.T) {
71 tests := []struct {

Callers

nothing calls this directly

Calls 7

VerifyMethod · 0.95
RegisterMethod · 0.95
QueryMatcherFunction · 0.92
StringResponseFunction · 0.92
userKeysFunction · 0.85
EqualMethod · 0.80
LenMethod · 0.65

Tested by

no test coverage detected