MCPcopy Index your code
hub / github.com/docker/cli / TestList

Function TestList

cli/command/plugin/list_test.go:62–182  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

60}
61
62func TestList(t *testing.T) {
63 singlePluginListFunc := func(client.PluginListOptions) (client.PluginListResult, error) {
64 return client.PluginListResult{
65 Items: plugin.ListResponse{
66 {
67 ID: "id-foo",
68 Name: "name-foo",
69 Enabled: true,
70 Config: plugin.Config{
71 Description: "desc-bar",
72 },
73 },
74 },
75 }, nil
76 }
77
78 testCases := []struct {
79 description string
80 args []string
81 flags map[string]string
82 golden string
83 listFunc func(client.PluginListOptions) (client.PluginListResult, error)
84 }{
85 {
86 description: "list with no additional flags",
87 args: []string{},
88 golden: "plugin-list-without-format.golden",
89 listFunc: singlePluginListFunc,
90 },
91 {
92 description: "list with filters",
93 args: []string{},
94 flags: map[string]string{
95 "filter": "foo=bar",
96 },
97 golden: "plugin-list-without-format.golden",
98 listFunc: func(opts client.PluginListOptions) (client.PluginListResult, error) {
99 assert.Check(t, opts.Filters["foo"]["bar"])
100 return singlePluginListFunc(opts)
101 },
102 },
103 {
104 description: "list with quiet option",
105 args: []string{},
106 flags: map[string]string{
107 "quiet": "true",
108 },
109 golden: "plugin-list-with-quiet-option.golden",
110 listFunc: singlePluginListFunc,
111 },
112 {
113 description: "list with no-trunc option",
114 args: []string{},
115 flags: map[string]string{
116 "no-trunc": "true",
117 "format": "{{ .ID }}",
118 },
119 golden: "plugin-list-with-no-trunc-option.golden",

Callers

nothing calls this directly

Calls 5

OutBufferMethod · 0.95
SetArgsMethod · 0.80
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…