MCPcopy Create free account
hub / github.com/52funny/pikpakcli / TestRunRejectsExistingConfigWithoutForce

Function TestRunRejectsExistingConfigWithoutForce

cli/setup/setup_test.go:69–86  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

67}
68
69func TestRunRejectsExistingConfigWithoutForce(t *testing.T) {
70 targetPath := filepath.Join(t.TempDir(), "config.yml")
71 require.NoError(t, os.WriteFile(targetPath, []byte("existing"), 0600))
72
73 _, err := Run(Options{
74 TargetPath: targetPath,
75 Prompts: &fakePrompts{
76 lines: []string{"user@example.com", "", ""},
77 password: "secret",
78 },
79 })
80 require.Error(t, err)
81 assert.Contains(t, err.Error(), "already exists")
82
83 bs, readErr := os.ReadFile(targetPath)
84 require.NoError(t, readErr)
85 assert.Equal(t, "existing", string(bs))
86}
87
88func TestRunOverwritesExistingConfigWithForce(t *testing.T) {
89 targetPath := filepath.Join(t.TempDir(), "config.yml")

Callers

nothing calls this directly

Calls 2

RunFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected