MCPcopy Create free account
hub / github.com/docker/cli / TestSecretInspectPretty

Function TestSecretInspectPretty

cli/command/secret/inspect_test.go:158–191  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

156}
157
158func TestSecretInspectPretty(t *testing.T) {
159 testCases := []struct {
160 name string
161 secretInspectFunc func(context.Context, string, client.SecretInspectOptions) (client.SecretInspectResult, error)
162 }{
163 {
164 name: "simple",
165 secretInspectFunc: func(_ context.Context, id string, _ client.SecretInspectOptions) (client.SecretInspectResult, error) {
166 return client.SecretInspectResult{
167 Secret: *builders.Secret(
168 builders.SecretLabels(map[string]string{
169 "lbl1": "value1",
170 }),
171 builders.SecretID("secretID"),
172 builders.SecretName("secretName"),
173 builders.SecretDriver("driver"),
174 builders.SecretCreatedAt(time.Time{}),
175 builders.SecretUpdatedAt(time.Time{}),
176 ),
177 }, nil
178 },
179 },
180 }
181 for _, tc := range testCases {
182 cli := test.NewFakeCli(&fakeClient{
183 secretInspectFunc: tc.secretInspectFunc,
184 })
185 cmd := newSecretInspectCommand(cli)
186 cmd.SetArgs([]string{"secretID"})
187 assert.Check(t, cmd.Flags().Set("pretty", "true"))
188 assert.NilError(t, cmd.Execute())
189 golden.Assert(t, cli.OutBuffer().String(), fmt.Sprintf("secret-inspect-pretty.%s.golden", tc.name))
190 }
191}

Callers

nothing calls this directly

Calls 5

OutBufferMethod · 0.95
newSecretInspectCommandFunction · 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…