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

Function Test_refreshRun

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

Source from the content-addressed store, hash-verified

221}
222
223func Test_refreshRun(t *testing.T) {
224 tests := []struct {
225 name string
226 opts *RefreshOptions
227 prompterStubs func(*prompter.PrompterMock)
228 cfgHosts []string
229 authOut authOut
230 oldScopes string
231 clipboard string
232 wantErr string
233 nontty bool
234 wantAuthArgs authArgs
235 }{
236 {
237 name: "no hosts configured",
238 opts: &RefreshOptions{},
239 wantErr: `not logged in to any hosts`,
240 },
241 {
242 name: "hostname given but not previously authenticated with it",
243 cfgHosts: []string{
244 "github.com",
245 "aline.cedrac",
246 },
247 opts: &RefreshOptions{
248 Hostname: "obed.morton",
249 },
250 wantErr: `not logged in to obed.morton`,
251 },
252 {
253 name: "hostname provided and is configured",
254 cfgHosts: []string{
255 "obed.morton",
256 "github.com",
257 },
258 opts: &RefreshOptions{
259 Hostname: "obed.morton",
260 },
261 wantAuthArgs: authArgs{
262 hostname: "obed.morton",
263 scopes: []string{},
264 secureStorage: true,
265 clipboard: true,
266 },
267 },
268 {
269 name: "no hostname, one host configured, clipboard enabled",
270 cfgHosts: []string{
271 "github.com",
272 },
273 opts: &RefreshOptions{
274 Hostname: "",
275 Clipboard: new(true),
276 },
277 wantAuthArgs: authArgs{
278 hostname: "github.com",
279 scopes: []string{},
280 secureStorage: true,

Callers

nothing calls this directly

Calls 15

RegisterMethod · 0.95
IndexForFunction · 0.92
NewIsolatedTestConfigFunction · 0.92
TestFunction · 0.92
RESTFunction · 0.92
tokenTypeAlias · 0.85
usernameTypeAlias · 0.85
refreshRunFunction · 0.85
SetStdinTTYMethod · 0.80
SetStdoutTTYMethod · 0.80
ContainsMethod · 0.80
EqualMethod · 0.80

Tested by

no test coverage detected