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

Function TestSecretListWithFormat

cli/command/secret/ls_test.go:123–140  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

121}
122
123func TestSecretListWithFormat(t *testing.T) {
124 cli := test.NewFakeCli(&fakeClient{
125 secretListFunc: func(_ context.Context, options client.SecretListOptions) (client.SecretListResult, error) {
126 return client.SecretListResult{
127 Items: []swarm.Secret{
128 *builders.Secret(builders.SecretID("ID-foo"), builders.SecretName("foo")),
129 *builders.Secret(builders.SecretID("ID-bar"), builders.SecretName("bar"), builders.SecretLabels(map[string]string{
130 "label": "label-bar",
131 })),
132 },
133 }, nil
134 },
135 })
136 cmd := newSecretListCommand(cli)
137 assert.Check(t, cmd.Flags().Set("format", "{{ .Name }} {{ .Labels }}"))
138 assert.NilError(t, cmd.Execute())
139 golden.Assert(t, cli.OutBuffer().String(), "secret-list-with-format.golden")
140}
141
142func TestSecretListWithFilter(t *testing.T) {
143 cli := test.NewFakeCli(&fakeClient{

Callers

nothing calls this directly

Calls 4

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