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

Function TestRunOverwritesExistingConfigWithForce

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

Source from the content-addressed store, hash-verified

86}
87
88func TestRunOverwritesExistingConfigWithForce(t *testing.T) {
89 targetPath := filepath.Join(t.TempDir(), "config.yml")
90 require.NoError(t, os.WriteFile(targetPath, []byte("existing"), 0600))
91
92 _, err := Run(Options{
93 Force: true,
94 TargetPath: targetPath,
95 Prompts: &fakePrompts{
96 lines: []string{"user@example.com", "", ""},
97 password: "secret",
98 },
99 })
100 require.NoError(t, err)
101
102 bs, readErr := os.ReadFile(targetPath)
103 require.NoError(t, readErr)
104 assert.Contains(t, string(bs), "username: user@example.com")
105 assert.NotEqual(t, "existing", string(bs))
106}
107
108func TestRunRequiresUsername(t *testing.T) {
109 targetPath := filepath.Join(t.TempDir(), "config.yml")

Callers

nothing calls this directly

Calls 1

RunFunction · 0.85

Tested by

no test coverage detected