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 444b486
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 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,8 +156,7 @@ 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"])

Expand All @@ -178,8 +166,7 @@ func TestUpdate(t *testing.T) {
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"])
require.Equal(t, "[email protected]:11", host.Connection)

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

0 comments on commit 444b486

Please sign in to comment.