mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-24 07:26:26 -06:00
c9e9e374bb
This is needed as preperation for adding WinRM support. There is still one error in the tests which needs another look, but other than that it seems like were now ready to start working on the WinRM part…
28 lines
671 B
Go
28 lines
671 B
Go
package ssh
|
|
|
|
import (
|
|
"golang.org/x/crypto/ssh"
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestPasswordKeyboardInteractive_Impl(t *testing.T) {
|
|
var raw interface{}
|
|
raw = PasswordKeyboardInteractive("foo")
|
|
if _, ok := raw.(ssh.KeyboardInteractiveChallenge); !ok {
|
|
t.Fatal("PasswordKeyboardInteractive must implement KeyboardInteractiveChallenge")
|
|
}
|
|
}
|
|
|
|
func TestPasswordKeybardInteractive_Challenge(t *testing.T) {
|
|
p := PasswordKeyboardInteractive("foo")
|
|
result, err := p("foo", "bar", []string{"one", "two"}, nil)
|
|
if err != nil {
|
|
t.Fatalf("err not nil: %s", err)
|
|
}
|
|
|
|
if !reflect.DeepEqual(result, []string{"foo", "foo"}) {
|
|
t.Fatalf("invalid password: %#v", result)
|
|
}
|
|
}
|