github.1git.de/docker/cli@v26.1.3+incompatible/cli/command/network/prune_test.go (about) 1 package network 2 3 import ( 4 "context" 5 "testing" 6 7 "github.com/docker/cli/internal/test" 8 "github.com/docker/docker/api/types" 9 "github.com/docker/docker/api/types/filters" 10 "github.com/pkg/errors" 11 ) 12 13 func TestNetworkPrunePromptTermination(t *testing.T) { 14 ctx, cancel := context.WithCancel(context.Background()) 15 t.Cleanup(cancel) 16 17 cli := test.NewFakeCli(&fakeClient{ 18 networkPruneFunc: func(ctx context.Context, pruneFilters filters.Args) (types.NetworksPruneReport, error) { 19 return types.NetworksPruneReport{}, errors.New("fakeClient networkPruneFunc should not be called") 20 }, 21 }) 22 cmd := NewPruneCommand(cli) 23 test.TerminatePrompt(ctx, t, cmd, cli) 24 }