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

Function TestNetworkRemovePromptTermination

cli/command/network/remove_test.go:106–131  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

104}
105
106func TestNetworkRemovePromptTermination(t *testing.T) {
107 ctx, cancel := context.WithCancel(context.Background())
108 t.Cleanup(cancel)
109
110 cli := test.NewFakeCli(&fakeClient{
111 networkRemoveFunc: func(ctx context.Context, networkID string) error {
112 return errors.New("fakeClient networkRemoveFunc should not be called")
113 },
114 networkInspectFunc: func(ctx context.Context, networkID string, options client.NetworkInspectOptions) (client.NetworkInspectResult, error) {
115 return client.NetworkInspectResult{
116 Network: network.Inspect{
117 Network: network.Network{
118 ID: "existing-network",
119 Name: "existing-network",
120 Ingress: true,
121 },
122 },
123 }, nil
124 },
125 })
126 cmd := newRemoveCommand(cli)
127 cmd.SetArgs([]string{"existing-network"})
128 cmd.SetOut(io.Discard)
129 cmd.SetErr(io.Discard)
130 test.TerminatePrompt(ctx, t, cmd, cli)
131}

Callers

nothing calls this directly

Calls 4

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