packer-cn/communicator/ssh/password_test.go

27 lines
482 B
Go
Raw Normal View History

package ssh
import (
"code.google.com/p/go.crypto/ssh"
"testing"
)
func TestPassword_Impl(t *testing.T) {
var raw interface{}
raw = Password("foo")
if _, ok := raw.(ssh.ClientPassword); !ok {
t.Fatal("Password must implement ClientPassword")
}
}
func TestPasswordPassword(t *testing.T) {
p := Password("foo")
result, err := p.Password("user")
if err != nil {
t.Fatalf("err not nil: %s", err)
}
if result != "foo" {
t.Fatalf("invalid password: %s", result)
}
}