github.com/deiscc/workflow-e2e@v0.0.0-20181208071258-117299af888f/tests/keys_test.go (about) 1 package tests 2 3 import ( 4 "fmt" 5 6 "github.com/deiscc/workflow-e2e/tests/cmd" 7 "github.com/deiscc/workflow-e2e/tests/cmd/auth" 8 "github.com/deiscc/workflow-e2e/tests/cmd/keys" 9 "github.com/deiscc/workflow-e2e/tests/model" 10 "github.com/deiscc/workflow-e2e/tests/settings" 11 12 . "github.com/onsi/ginkgo" 13 . "github.com/onsi/gomega" 14 . "github.com/onsi/gomega/gbytes" 15 . "github.com/onsi/gomega/gexec" 16 ) 17 18 var _ = Describe("deis keys", func() { 19 20 Context("with an existing user", func() { 21 22 var user model.User 23 24 BeforeEach(func() { 25 user = auth.RegisterAndLogin() 26 }) 27 28 AfterEach(func() { 29 auth.Cancel(user) 30 }) 31 32 Context("who has at least one key", func() { 33 34 var keyName string 35 36 BeforeEach(func() { 37 keyName, _ = keys.Add(user) 38 }) 39 40 Specify("that user can list their own keys", func() { 41 sess, err := cmd.Start("deis keys:list", &user) 42 Eventually(sess, settings.MaxEventuallyTimeout).Should(Say(fmt.Sprintf("%s ssh-rsa", keyName))) 43 Expect(err).NotTo(HaveOccurred()) 44 Eventually(sess).Should(Exit(0)) 45 }) 46 47 }) 48 49 Specify("that user can add and remove keys", func() { 50 keyName, _ := keys.Add(user) 51 keys.Remove(user, keyName) 52 }) 53 54 }) 55 56 })