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

Function TestValidateRefreshableCredential

internal/config/refreshable_test.go:216–248  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

214}
215
216func TestValidateRefreshableCredential(t *testing.T) {
217 tests := []struct {
218 name string
219 cred gh.Credential
220 wantErr bool
221 }{
222 {
223 name: "missing access token",
224 cred: gh.Credential{RefreshToken: "refresh"},
225 wantErr: true,
226 },
227 {
228 name: "missing refresh token",
229 cred: gh.Credential{Token: "access"},
230 wantErr: true,
231 },
232 {
233 name: "valid",
234 cred: gh.Credential{Token: "access", RefreshToken: "refresh"},
235 wantErr: false,
236 },
237 }
238 for _, tt := range tests {
239 t.Run(tt.name, func(t *testing.T) {
240 err := validateRefreshableCredential(tt.cred)
241 if tt.wantErr {
242 require.Error(t, err)
243 return
244 }
245 require.NoError(t, err)
246 })
247 }
248}
249
250func TestSetActiveCredential(t *testing.T) {
251 tests := []struct {

Callers

nothing calls this directly

Calls 3

RunMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected