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

Function Test_NewCmdRefresh

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

Source from the content-addressed store, hash-verified

28)
29
30func Test_NewCmdRefresh(t *testing.T) {
31 tests := []struct {
32 name string
33 cli string
34 wants RefreshOptions
35 wantsErr bool
36 tty bool
37 neverPrompt bool
38 }{
39 {
40 name: "tty no arguments",
41 tty: true,
42 wants: RefreshOptions{
43 Hostname: "",
44 },
45 },
46 {
47 name: "tty clipboard",
48 tty: true,
49 cli: "-c",
50 wants: RefreshOptions{
51 Hostname: "",
52 Clipboard: new(true),
53 },
54 },
55 {
56 name: "tty expiring",
57 tty: true,
58 cli: "--expiring",
59 wants: RefreshOptions{
60 Hostname: "",
61 Expiring: new(true),
62 },
63 },
64 {
65 name: "tty expiring=false",
66 tty: true,
67 cli: "--expiring=false",
68 wants: RefreshOptions{
69 Hostname: "",
70 Expiring: new(false),
71 },
72 },
73 {
74 name: "nontty no arguments",
75 wantsErr: true,
76 },
77 {
78 name: "nontty hostname and clipboard",
79 cli: "-h aline.cedrac -c",
80 wants: RefreshOptions{
81 Hostname: "aline.cedrac",
82 Clipboard: new(true),
83 },
84 },
85 {
86 name: "nontty hostname",
87 cli: "-h aline.cedrac",

Callers

nothing calls this directly

Calls 8

TestFunction · 0.92
NewCmdRefreshFunction · 0.85
SetStdinTTYMethod · 0.80
SetStdoutTTYMethod · 0.80
SetNeverPromptMethod · 0.80
EqualMethod · 0.80
RunMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected