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

Function TestVolumeListWithFormat

cli/command/volume/list_test.go:92–110  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

90}
91
92func TestVolumeListWithFormat(t *testing.T) {
93 cli := test.NewFakeCli(&fakeClient{
94 volumeListFunc: func(client.VolumeListOptions) (client.VolumeListResult, error) {
95 return client.VolumeListResult{
96 Items: []volume.Volume{
97 builders.Volume(),
98 builders.Volume(builders.VolumeName("foo"), builders.VolumeDriver("bar")),
99 builders.Volume(builders.VolumeName("baz"), builders.VolumeLabels(map[string]string{
100 "foo": "bar",
101 })),
102 },
103 }, nil
104 },
105 })
106 cmd := newListCommand(cli)
107 assert.Check(t, cmd.Flags().Set("format", "{{ .Name }} {{ .Driver }} {{ .Labels }}"))
108 assert.NilError(t, cmd.Execute())
109 golden.Assert(t, cli.OutBuffer().String(), "volume-list-with-format.golden")
110}
111
112func TestVolumeListSortOrder(t *testing.T) {
113 cli := test.NewFakeCli(&fakeClient{

Callers

nothing calls this directly

Calls 4

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