MCPcopy Create free account
hub / github.com/google/go-github / TestActionsService_GetRepoPublicKey

Function TestActionsService_GetRepoPublicKey

github/actions_secrets_test.go:95–128  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

93}
94
95func TestActionsService_GetRepoPublicKey(t *testing.T) {
96 t.Parallel()
97 client, mux, _ := setup(t)
98
99 mux.HandleFunc("/repos/o/r/actions/secrets/public-key", func(w http.ResponseWriter, r *http.Request) {
100 testMethod(t, r, "GET")
101 fmt.Fprint(w, `{"key_id":"1234","key":"2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234"}`)
102 })
103
104 ctx := t.Context()
105 key, _, err := client.Actions.GetRepoPublicKey(ctx, "o", "r")
106 if err != nil {
107 t.Errorf("Actions.GetRepoPublicKey returned error: %v", err)
108 }
109
110 want := &PublicKey{KeyID: Ptr("1234"), Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")}
111 if !cmp.Equal(key, want) {
112 t.Errorf("Actions.GetRepoPublicKey returned %+v, want %+v", key, want)
113 }
114
115 const methodName = "GetRepoPublicKey"
116 testBadOptions(t, methodName, func() (err error) {
117 _, _, err = client.Actions.GetRepoPublicKey(ctx, "\n", "\n")
118 return err
119 })
120
121 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
122 got, resp, err := client.Actions.GetRepoPublicKey(ctx, "o", "r")
123 if got != nil {
124 t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
125 }
126 return resp, err
127 })
128}
129
130func TestActionsService_GetRepoPublicKeyNumeric(t *testing.T) {
131 t.Parallel()

Callers

nothing calls this directly

Calls 7

testMethodFunction · 0.85
testBadOptionsFunction · 0.85
EqualMethod · 0.80
setupFunction · 0.70
PtrFunction · 0.70
GetRepoPublicKeyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…