github.com/cloudbase/juju-core@v0.0.0-20140504232958-a7271ac7912f/utils/ssh/generate_test.go (about) 1 // Copyright 2013 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package ssh_test 5 6 import ( 7 gc "launchpad.net/gocheck" 8 9 jc "launchpad.net/juju-core/testing/checkers" 10 "launchpad.net/juju-core/testing/testbase" 11 "launchpad.net/juju-core/utils/ssh" 12 ) 13 14 type GenerateSuite struct { 15 testbase.LoggingSuite 16 } 17 18 var _ = gc.Suite(&GenerateSuite{}) 19 20 func (s *GenerateSuite) TestGenerate(c *gc.C) { 21 private, public, err := ssh.GenerateKey("some-comment") 22 23 c.Check(err, gc.IsNil) 24 c.Check(private, jc.HasPrefix, "-----BEGIN RSA PRIVATE KEY-----\n") 25 c.Check(private, jc.HasSuffix, "-----END RSA PRIVATE KEY-----\n") 26 c.Check(public, jc.HasPrefix, "ssh-rsa ") 27 c.Check(public, jc.HasSuffix, " some-comment\n") 28 }