MCPcopy Index your code
hub / github.com/cli/cli / Test_refreshRun

Function Test_refreshRun

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

Source from the content-addressed store, hash-verified

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

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