(t *testing.T)
| 121 | } |
| 122 | |
| 123 | func 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 | |
| 142 | func TestSecretListWithFilter(t *testing.T) { |
| 143 | cli := test.NewFakeCli(&fakeClient{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…