(t *testing.T)
| 93 | } |
| 94 | |
| 95 | func 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 | |
| 130 | func TestActionsService_GetRepoPublicKeyNumeric(t *testing.T) { |
| 131 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…