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

Function Test_listRun

pkg/cmd/variable/list/list_test.go:83–306  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

81}
82
83func Test_listRun(t *testing.T) {
84 tests := []struct {
85 name string
86 tty bool
87 opts *ListOptions
88 jsonFields []string
89 wantOut []string
90 }{
91 {
92 name: "repo tty",
93 tty: true,
94 opts: &ListOptions{},
95 wantOut: []string{
96 "NAME VALUE UPDATED",
97 "VARIABLE_ONE one about 34 years ago",
98 "VARIABLE_TWO two about 2 years ago",
99 "VARIABLE_THREE three about 47 years ago",
100 },
101 },
102 {
103 name: "repo not tty",
104 tty: false,
105 opts: &ListOptions{},
106 wantOut: []string{
107 "VARIABLE_ONE\tone\t1988-10-11T00:00:00Z",
108 "VARIABLE_TWO\ttwo\t2020-12-04T00:00:00Z",
109 "VARIABLE_THREE\tthree\t1975-11-30T00:00:00Z",
110 },
111 },
112 {
113 name: "repo not tty, json",
114 tty: false,
115 opts: &ListOptions{},
116 jsonFields: []string{"name", "value"},
117 wantOut: []string{`[
118 {"name":"VARIABLE_ONE","value":"one"},
119 {"name":"VARIABLE_TWO","value":"two"},
120 {"name":"VARIABLE_THREE","value":"three"}
121 ]`},
122 },
123 {
124 name: "org tty",
125 tty: true,
126 opts: &ListOptions{
127 OrgName: "UmbrellaCorporation",
128 },
129 wantOut: []string{
130 "NAME VALUE UPDATED VISIBILITY",
131 "VARIABLE_ONE org_one about 34 years ago Visible to all repositories",
132 "VARIABLE_TWO org_two about 2 years ago Visible to private repositories",
133 "VARIABLE_THREE org_three about 47 years ago Visible to 2 selected reposito...",
134 },
135 },
136 {
137 name: "org not tty",
138 tty: false,
139 opts: &ListOptions{
140 OrgName: "UmbrellaCorporation",

Callers

nothing calls this directly

Calls 15

VerifyMethod · 0.95
RegisterMethod · 0.95
RESTFunction · 0.92
JSONResponseFunction · 0.92
TestFunction · 0.92
FromFullNameFunction · 0.92
NewMockConfigFunction · 0.92
NewJSONExporterFunction · 0.92
SetStdoutTTYMethod · 0.80
SetFieldsMethod · 0.80
JoinMethod · 0.80
EqualMethod · 0.80

Tested by

no test coverage detected