MCPcopy Index your code
hub / github.com/docker/cli / TestConfigInspectPretty

Function TestConfigInspectPretty

cli/command/config/inspect_test.go:155–189  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

153}
154
155func TestConfigInspectPretty(t *testing.T) {
156 testCases := []struct {
157 name string
158 configInspectFunc func(context.Context, string, client.ConfigInspectOptions) (client.ConfigInspectResult, error)
159 }{
160 {
161 name: "simple",
162 configInspectFunc: func(_ context.Context, id string, _ client.ConfigInspectOptions) (client.ConfigInspectResult, error) {
163 return client.ConfigInspectResult{
164 Config: *builders.Config(
165 builders.ConfigLabels(map[string]string{
166 "lbl1": "value1",
167 }),
168 builders.ConfigID("configID"),
169 builders.ConfigName("configName"),
170 builders.ConfigCreatedAt(time.Time{}),
171 builders.ConfigUpdatedAt(time.Time{}),
172 builders.ConfigData([]byte("payload here")),
173 ),
174 }, nil
175 },
176 },
177 }
178 for _, tc := range testCases {
179 cli := test.NewFakeCli(&fakeClient{
180 configInspectFunc: tc.configInspectFunc,
181 })
182 cmd := newConfigInspectCommand(cli)
183
184 cmd.SetArgs([]string{"configID"})
185 assert.Check(t, cmd.Flags().Set("pretty", "true"))
186 assert.NilError(t, cmd.Execute())
187 golden.Assert(t, cli.OutBuffer().String(), fmt.Sprintf("config-inspect-pretty.%s.golden", tc.name))
188 }
189}

Callers

nothing calls this directly

Calls 5

OutBufferMethod · 0.95
newConfigInspectCommandFunction · 0.85
SetArgsMethod · 0.80
StringMethod · 0.65
SetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…