github.com/jerryclinesmith/packer@v0.3.7/communicator/ssh/keychain_test.go (about) 1 package ssh 2 3 import ( 4 "code.google.com/p/go.crypto/ssh" 5 "testing" 6 ) 7 8 const testPrivateKey = `-----BEGIN RSA PRIVATE KEY----- 9 MIIBOwIBAAJBALdGZxkXDAjsYk10ihwU6Id2KeILz1TAJuoq4tOgDWxEEGeTrcld 10 r/ZwVaFzjWzxaf6zQIJbfaSEAhqD5yo72+sCAwEAAQJBAK8PEVU23Wj8mV0QjwcJ 11 tZ4GcTUYQL7cF4+ezTCE9a1NrGnCP2RuQkHEKxuTVrxXt+6OF15/1/fuXnxKjmJC 12 nxkCIQDaXvPPBi0c7vAxGwNY9726x01/dNbHCE0CBtcotobxpwIhANbbQbh3JHVW 13 2haQh4fAG5mhesZKAGcxTyv4mQ7uMSQdAiAj+4dzMpJWdSzQ+qGHlHMIBvVHLkqB 14 y2VdEyF7DPCZewIhAI7GOI/6LDIFOvtPo6Bj2nNmyQ1HU6k/LRtNIXi4c9NJAiAr 15 rrxx26itVhJmcvoUhOjwuzSlP2bE5VHAvkGB352YBg== 16 -----END RSA PRIVATE KEY-----` 17 18 func TestAddPEMKey(t *testing.T) { 19 k := &SimpleKeychain{} 20 err := k.AddPEMKey(testPrivateKey) 21 if err != nil { 22 t.Fatalf("error while adding key: %s", err) 23 } 24 } 25 26 func TestSimpleKeyChain_ImplementsClientkeyring(t *testing.T) { 27 var raw interface{} 28 raw = &SimpleKeychain{} 29 if _, ok := raw.(ssh.ClientKeyring); !ok { 30 t.Fatal("SimpleKeychain is not a valid ssh.ClientKeyring") 31 } 32 }