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

Function Test_NewCmdRefresh

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

Source from the content-addressed store, hash-verified

18)
19
20func Test_NewCmdRefresh(t *testing.T) {
21 tests := []struct {
22 name string
23 cli string
24 wants RefreshOptions
25 wantsErr bool
26 tty bool
27 neverPrompt bool
28 }{
29 {
30 name: "tty no arguments",
31 tty: true,
32 wants: RefreshOptions{
33 Hostname: "",
34 },
35 },
36 {
37 name: "tty clipboard",
38 tty: true,
39 cli: "-c",
40 wants: RefreshOptions{
41 Hostname: "",
42 Clipboard: true,
43 },
44 },
45 {
46 name: "nontty no arguments",
47 wantsErr: true,
48 },
49 {
50 name: "nontty hostname and clipboard",
51 cli: "-h aline.cedrac -c",
52 wants: RefreshOptions{
53 Hostname: "aline.cedrac",
54 Clipboard: true,
55 },
56 },
57 {
58 name: "nontty hostname",
59 cli: "-h aline.cedrac",
60 wants: RefreshOptions{
61 Hostname: "aline.cedrac",
62 },
63 },
64 {
65 name: "tty hostname and clipboard",
66 tty: true,
67 cli: "-h aline.cedrac -c",
68 wants: RefreshOptions{
69 Hostname: "aline.cedrac",
70 Clipboard: true,
71 },
72 },
73 {
74 name: "tty hostname",
75 tty: true,
76 cli: "-h aline.cedrac",
77 wants: RefreshOptions{

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