open-vault/api/ssh_agent_test.go
2016-02-26 17:01:40 -05:00

31 lines
734 B
Go

package api
import (
"fmt"
"testing"
)
func TestSSH_CreateTLSClient(t *testing.T) {
// load the default configuration
config, err := LoadSSHHelperConfig("./test-fixtures/agent_config.hcl")
if err != nil {
panic(fmt.Sprintf("error loading agent's config file: %s", err))
}
client, err := config.NewClient()
if err != nil {
panic(fmt.Sprintf("error creating the client: %s", err))
}
// Provide a certificate and enforce setting of transport
config.CACert = "./test-fixtures/vault.crt"
client, err = config.NewClient()
if err != nil {
panic(fmt.Sprintf("error creating the client: %s", err))
}
if client.config.HttpClient.Transport == nil {
panic(fmt.Sprintf("error creating client with TLS transport"))
}
}