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

Function Test_refreshRun

pkg/cmd/auth/refresh/refresh_test.go:253–856  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

251}
252
253func Test_refreshRun(t *testing.T) {
254 tests := []struct {
255 name string
256 opts *RefreshOptions
257 prompterStubs func(*prompter.PrompterMock)
258 cfgHosts []string
259 cfgRefreshable bool
260 cfgRefreshableExpired bool
261 refreshSkipped bool
262 refresher *ghmock.TokenRefresherMock
263 authOut authOut
264 oldScopes string
265 clipboard string
266 expiringCredentialsCfg string
267 wantErr string
268 nontty bool
269 wantAuthArgs authArgs
270 wantStoredToken string
271 wantStoredRefreshToken string
272 wantStderrContains string
273 wantStderrOmits string
274 }{
275 {
276 name: "no hosts configured",
277 opts: &RefreshOptions{},
278 wantErr: `not logged in to any hosts`,
279 },
280 {
281 name: "hostname given but not previously authenticated with it",
282 cfgHosts: []string{
283 "github.com",
284 "aline.cedrac",
285 },
286 opts: &RefreshOptions{
287 Hostname: "obed.morton",
288 },
289 wantErr: `not logged in to obed.morton`,
290 },
291 {
292 name: "hostname provided and is configured",
293 cfgHosts: []string{
294 "obed.morton",
295 "github.com",
296 },
297 opts: &RefreshOptions{
298 Hostname: "obed.morton",
299 },
300 wantAuthArgs: authArgs{
301 hostname: "obed.morton",
302 scopes: []string{},
303 secureStorage: true,
304 clipboard: true,
305 },
306 },
307 {
308 name: "no hostname, one host configured, clipboard enabled",
309 cfgHosts: []string{
310 "github.com",

Callers

nothing calls this directly

Calls 15

RegisterMethod · 0.95
IndexForFunction · 0.92
NewIsolatedTestConfigFunction · 0.92
TestFunction · 0.92
RESTFunction · 0.92
refreshRunFunction · 0.85
SetStdinTTYMethod · 0.80
SetStdoutTTYMethod · 0.80
ContainsMethod · 0.80
EqualMethod · 0.80
renewingRefresherFunction · 0.70
failingRefresherFunction · 0.70

Tested by

no test coverage detected