MCPcopy Create free account
hub / github.com/Driver-C/tryssh / TestUpdateConfig

Function TestUpdateConfig

pkg/config/loader_test.go:308–326  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

306}
307
308func TestUpdateConfig(t *testing.T) {
309 // Save and restore the default config path
310 origPath := DefaultConfigPath
311 defer func() { DefaultConfigPath = origPath }()
312
313 dir := testutil.TempDir(t)
314 configPath := filepath.Join(dir, ConfigDirName, ConfigFileName)
315 DefaultConfigPath = configPath
316
317 conf := &MainConfig{}
318 conf.Main.Ports = []string{"22"}
319 conf.Main.Users = []string{"testuser"}
320 conf.Main.Passwords = []string{"testpass"}
321 conf.Main.Keys = []string{}
322
323 err := UpdateConfig(conf)
324 assert.NoError(t, err)
325 assert.FileExists(t, configPath)
326}
327
328
329func TestServerListConfig_String(t *testing.T) {

Callers

nothing calls this directly

Calls 2

TempDirFunction · 0.92
UpdateConfigFunction · 0.85

Tested by

no test coverage detected