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

Function TestNewInspectCommandErrors

cli/command/image/inspect_test.go:16–37  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

14)
15
16func TestNewInspectCommandErrors(t *testing.T) {
17 testCases := []struct {
18 name string
19 args []string
20 expectedError string
21 }{
22 {
23 name: "wrong-args",
24 args: []string{},
25 expectedError: "requires at least 1 argument",
26 },
27 }
28 for _, tc := range testCases {
29 t.Run(tc.name, func(t *testing.T) {
30 cmd := newInspectCommand(test.NewFakeCli(&fakeClient{}))
31 cmd.SetOut(io.Discard)
32 cmd.SetErr(io.Discard)
33 cmd.SetArgs(tc.args)
34 assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
35 })
36 }
37}
38
39func TestNewInspectCommandSuccess(t *testing.T) {
40 imageInspectInvocationCount := 0

Callers

nothing calls this directly

Calls 4

SetArgsMethod · 0.80
newInspectCommandFunction · 0.70
SetOutMethod · 0.45
SetErrMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…