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

Function TestSecretList

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

Source from the content-addressed store, hash-verified

47}
48
49func TestSecretList(t *testing.T) {
50 cli := test.NewFakeCli(&fakeClient{
51 secretListFunc: func(_ context.Context, options client.SecretListOptions) (client.SecretListResult, error) {
52 return client.SecretListResult{
53 Items: []swarm.Secret{
54 *builders.Secret(builders.SecretID("ID-1-foo"),
55 builders.SecretName("1-foo"),
56 builders.SecretVersion(swarm.Version{Index: 10}),
57 builders.SecretCreatedAt(time.Now().Add(-2*time.Hour)),
58 builders.SecretUpdatedAt(time.Now().Add(-1*time.Hour)),
59 ),
60 *builders.Secret(builders.SecretID("ID-10-foo"),
61 builders.SecretName("10-foo"),
62 builders.SecretVersion(swarm.Version{Index: 11}),
63 builders.SecretCreatedAt(time.Now().Add(-2*time.Hour)),
64 builders.SecretUpdatedAt(time.Now().Add(-1*time.Hour)),
65 builders.SecretDriver("driver"),
66 ),
67 *builders.Secret(builders.SecretID("ID-2-foo"),
68 builders.SecretName("2-foo"),
69 builders.SecretVersion(swarm.Version{Index: 11}),
70 builders.SecretCreatedAt(time.Now().Add(-2*time.Hour)),
71 builders.SecretUpdatedAt(time.Now().Add(-1*time.Hour)),
72 builders.SecretDriver("driver"),
73 ),
74 },
75 }, nil
76 },
77 })
78 cmd := newSecretListCommand(cli)
79 assert.NilError(t, cmd.Execute())
80 golden.Assert(t, cli.OutBuffer().String(), "secret-list-sort.golden")
81}
82
83func TestSecretListWithQuietOption(t *testing.T) {
84 cli := test.NewFakeCli(&fakeClient{

Callers

nothing calls this directly

Calls 3

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…