-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathkeys_test.go
More file actions
47 lines (39 loc) · 1.16 KB
/
keys_test.go
File metadata and controls
47 lines (39 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package _tests_test
import (
"os"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Keys", func() {
key := testUser
BeforeEach(func() {
addKey(key)
})
AfterEach(func() {
// remove the generated ssh key
key := testUser
execute("deis keys:remove %s", key)
err := os.Remove(key)
Expect(err).NotTo(HaveOccurred())
err = os.Remove(key + ".pub")
Expect(err).NotTo(HaveOccurred())
})
Context("with a new key", func() {
It("can add the key", func() {
output, err := execute("deis keys:add %s.pub", key)
Expect(err).NotTo(HaveOccurred())
Expect(output).To(ContainSubstring("Uploading %s.pub to deis... done", key))
output, err = execute("deis keys:list")
Expect(err).NotTo(HaveOccurred())
Expect(output).To(ContainSubstring("%s@deis.com", key))
})
It("can remove the key", func() {
output, err := execute("deis keys:remove %s@deis.com", key)
Expect(err).NotTo(HaveOccurred())
Expect(output).To(ContainSubstring("Removing %s@deis.com SSH Key... done", key))
output, err = execute("deis keys")
Expect(err).NotTo(HaveOccurred())
Expect(output).NotTo(ContainSubstring("%s@deis.com", key))
})
})
})