| 136 | } |
| 137 | |
| 138 | func TestRunRejectsInvalidProxy(t *testing.T) { |
| 139 | targetPath := filepath.Join(t.TempDir(), "config.yml") |
| 140 | |
| 141 | _, err := Run(Options{ |
| 142 | TargetPath: targetPath, |
| 143 | Prompts: &fakePrompts{ |
| 144 | lines: []string{"user@example.com", "127.0.0.1:7890", ""}, |
| 145 | password: "secret", |
| 146 | }, |
| 147 | }) |
| 148 | require.Error(t, err) |
| 149 | assert.Contains(t, err.Error(), "proxy should contains ://") |
| 150 | assert.NoFileExists(t, targetPath) |
| 151 | } |
| 152 | |
| 153 | func TestConfigTemplateIsLoaded(t *testing.T) { |
| 154 | assert.Contains(t, string(configTemplate), "username: xxx") |