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

Function TestSecretListWithConfigFormat

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

Source from the content-addressed store, hash-verified

100}
101
102func TestSecretListWithConfigFormat(t *testing.T) {
103 cli := test.NewFakeCli(&fakeClient{
104 secretListFunc: func(_ context.Context, options client.SecretListOptions) (client.SecretListResult, error) {
105 return client.SecretListResult{
106 Items: []swarm.Secret{
107 *builders.Secret(builders.SecretID("ID-foo"), builders.SecretName("foo")),
108 *builders.Secret(builders.SecretID("ID-bar"), builders.SecretName("bar"), builders.SecretLabels(map[string]string{
109 "label": "label-bar",
110 })),
111 },
112 }, nil
113 },
114 })
115 cli.SetConfigFile(&configfile.ConfigFile{
116 SecretFormat: "{{ .Name }} {{ .Labels }}",
117 })
118 cmd := newSecretListCommand(cli)
119 assert.NilError(t, cmd.Execute())
120 golden.Assert(t, cli.OutBuffer().String(), "secret-list-with-config-format.golden")
121}
122
123func TestSecretListWithFormat(t *testing.T) {
124 cli := test.NewFakeCli(&fakeClient{

Callers

nothing calls this directly

Calls 4

SetConfigFileMethod · 0.95
OutBufferMethod · 0.95
newSecretListCommandFunction · 0.85
StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…