Skip to content

Commit

Permalink
fix test case
Browse files Browse the repository at this point in the history
  • Loading branch information
xwjdsh committed Jan 27, 2022
1 parent 4eb15f6 commit b5e7210
Showing 1 changed file with 3 additions and 24 deletions.
27 changes: 3 additions & 24 deletions manssh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,9 @@ func TestList(t *testing.T) {

main2 := hostMap["main2"]
require.NotNil(t, main2)
require.Equal(t, 2, len(main2.OwnConfig))
require.Equal(t, "[email protected]:22022", main2.Connection)
require.Equal(t, 1, len(main2.ImplicitConfig))
require.Empty(t, main2.OwnConfig["port"])
require.Equal(t, "22022", main2.ImplicitConfig["port"])
require.Equal(t, "192.168.2.20", main2.OwnConfig["hostname"])

home1 := hostMap["home1"]
require.NotNil(t, home1)
require.Equal(t, 3, len(home1.OwnConfig))
require.Equal(t, 0, len(home1.ImplicitConfig))
require.Equal(t, "77", home1.OwnConfig["port"])
require.Equal(t, "ROOT", home1.OwnConfig["user"])
require.Equal(t, "192.168.3.10", home1.OwnConfig["hostname"])

hosts, err = List(mainConfigPath, ListOption{
Keywords: []string{"Test"},
Expand Down Expand Up @@ -140,8 +130,7 @@ func TestAdd(t *testing.T) {
})
require.Nil(t, err)
require.Equal(t, "22022", host.ImplicitConfig["port"])
require.Equal(t, "1.2.3.4", host.OwnConfig["hostname"])
require.Equal(t, "xxx", host.OwnConfig["user"])
require.Equal(t, "[email protected]:22022", host.Connection)

hosts, err := List(mainConfigPath, ListOption{})
require.Nil(t, err)
Expand All @@ -167,20 +156,10 @@ func TestUpdate(t *testing.T) {
},
})
require.Nil(t, err)
require.Equal(t, "1.2.3.4", host.OwnConfig["hostname"])
require.Equal(t, "xxx", host.OwnConfig["user"])
require.Equal(t, "[email protected]:22022", host.Connection)
require.Equal(t, "~/.ssh/test4", host.OwnConfig["identifyfile"])
require.Equal(t, "22022", host.ImplicitConfig["port"])

host, err = Update(mainConfigPath, &UpdateOption{
Alias: "home1",
Connect: "1.2.3.4:11",
Config: map[string]string{},
})
require.Nil(t, err)
require.Equal(t, "1.2.3.4", host.OwnConfig["hostname"])
require.Equal(t, "11", host.OwnConfig["port"])

hosts, err := List(mainConfigPath, ListOption{})
require.Nil(t, err)
require.Equal(t, 10, len(hosts))
Expand Down

0 comments on commit b5e7210

Please sign in to comment.