github.com/terramate-io/tf@v0.0.0-20230830114523-fce866b4dfcd/communicator/ssh/password_test.go (about)

     1  // Copyright (c) HashiCorp, Inc.
     2  // SPDX-License-Identifier: MPL-2.0
     3  
     4  package ssh
     5  
     6  import (
     7  	"reflect"
     8  	"testing"
     9  )
    10  
    11  func TestPasswordKeybardInteractive_Challenge(t *testing.T) {
    12  	p := PasswordKeyboardInteractive("foo")
    13  	result, err := p("foo", "bar", []string{"one", "two"}, nil)
    14  	if err != nil {
    15  		t.Fatalf("err not nil: %s", err)
    16  	}
    17  
    18  	if !reflect.DeepEqual(result, []string{"foo", "foo"}) {
    19  		t.Fatalf("invalid password: %#v", result)
    20  	}
    21  }