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

Function TestRemoveCurrentForce

cli/command/context/remove_test.go:42–56  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

40}
41
42func TestRemoveCurrentForce(t *testing.T) {
43 configDir := t.TempDir()
44 configFilePath := filepath.Join(configDir, "config.json")
45 testCfg := configfile.New(configFilePath)
46 testCfg.CurrentContext = "current"
47 assert.NilError(t, testCfg.Save())
48
49 cli := makeFakeCli(t, withCliConfig(testCfg))
50 createTestContexts(t, cli, "current", "other")
51 cli.SetCurrentContext("current")
52 assert.NilError(t, runRemove(cli, removeOptions{force: true}, []string{"current"}))
53 reloadedConfig, err := config.Load(configDir)
54 assert.NilError(t, err)
55 assert.Equal(t, "", reloadedConfig.CurrentContext)
56}
57
58func TestRemoveDefault(t *testing.T) {
59 cli := makeFakeCli(t)

Callers

nothing calls this directly

Calls 6

makeFakeCliFunction · 0.85
withCliConfigFunction · 0.85
createTestContextsFunction · 0.85
SetCurrentContextMethod · 0.80
runRemoveFunction · 0.70
SaveMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…