@@ -2,44 +2,77 @@ package _tests_test
22
33import (
44 . "github.com/onsi/ginkgo"
5- // . "github.com/onsi/gomega"
5+ . "github.com/onsi/gomega"
66)
77
88var _ = Describe ("Config" , func () {
99 Context ("with a deployed app" , func () {
10+ appName := getRandAppName ()
11+ BeforeEach (func () {
12+ login (url , testUser , testPassword )
13+ })
14+
15+ It ("can create a new app" , func () {
16+ output , err := execute ("deis apps:create %s" , appName )
17+ Expect (err ).NotTo (HaveOccurred ())
18+ Expect (output ).To (SatisfyAll (
19+ ContainSubstring ("Creating Application... done, created %s" , appName ),
20+ ContainSubstring ("Git remote deis added" ),
21+ ContainSubstring ("remote available at " )))
22+ })
23+
24+ It ("can list environment variables" , func () {
25+ out , err := execute ("deis config:set FOO=bar -a %s" , appName )
26+ Expect (err ).NotTo (HaveOccurred ())
27+ Expect (out ).To (SatisfyAll (
28+ ContainSubstring ("Creating config... done" ),
29+ ContainSubstring ("FOO bar" ),
30+ ContainSubstring ("=== %s Config" , appName ),
31+ ))
32+ out , err = execute ("deis config:list -a %s" , appName )
33+ Expect (err ).NotTo (HaveOccurred ())
34+ Expect (out ).To (SatisfyAll (
35+ ContainSubstring ("=== %s Config" , appName ),
36+ ContainSubstring ("FOO bar" ),
37+ ))
38+ // TODO: the following won't work as-is because there is no app running
39+ // "deis run env -a %s"
1040
11- XIt ("can list environment variables" , func () {
12- // "deis config:set FOO=bar--app=%s"
13- // "deis run env --app=%s"
14- // "deis config:list --app=%s"
1541 })
1642
17- XIt ("can set an integer environment variable" , func () {
18- // "deis config:set FOO=10 --app=%s"
19- // "deis run env --app=%s"
43+ It ("can set an integer environment variable" , func () {
44+ out , err := execute ("deis config:set FOO=1 -a %s" , appName )
45+ Expect (err ).NotTo (HaveOccurred ())
46+ Expect (out ).To (ContainSubstring ("FOO 1" ))
2047 })
2148
22- XIt ("can set an environment variable containing spaces" , func () {
23- // "config:set POWERED_BY=\"the Deis team\" --app={{.AppName}}"
24- // "deis run env --app=%s"
49+ It ("can set an environment variable containing spaces" , func () {
50+ out , err := execute (`deis config:set POWERED_BY=the\ Deis\ team -a %s` , appName )
51+ Expect (err ).NotTo (HaveOccurred ())
52+ Expect (out ).To (ContainSubstring ("POWERED_BY the Deis team" ))
2553 })
2654
27- XIt ("can set a multi-line environment variable" , func () {
28- // `deis config:set FOO="This is a
29- //multiline string" --app={{.AppName}}`
30- // "deis run env --app=%s"
55+ It ("can set a multi-line environment variable" , func () {
56+ out , err := execute (`deis config:set FOO=This\ is\ a\
57+ multiline\ string -a %s` , appName )
58+ Expect (err ).NotTo (HaveOccurred ())
59+ Expect (out ).To (ContainSubstring (`FOO This\ is\ a\
60+ multiline\ string` ))
3161 })
3262
33- XIt ("can set an environment variable with multibyte chars" , func () {
34- // "deis config:set FOO=讲台 --app=%s"
35- // "deis run env --app=%s"
63+ It ("can set an environment variable with multibyte chars" , func () {
64+ out , err := execute ("deis config:set FOO=讲台 -a %s" , appName )
65+ Expect (err ).NotTo (HaveOccurred ())
66+ Expect (out ).To (ContainSubstring ("FOO 讲台" ))
3667 })
3768
38- XIt ("can unset an environment variable" , func () {
39- // "deis config:set FOO=bar --app=%s"
40- // "deis run env --app=%s"
41- // "deis config:unset FOO --app=%s"
42- // "deis run env --app=%s"
69+ It ("can unset an environment variable" , func () {
70+ out , err := execute ("deis config:set FOO=bar -a %s" , appName )
71+ Expect (err ).NotTo (HaveOccurred ())
72+ Expect (out ).To (ContainSubstring ("FOO bar" ))
73+ out , err = execute ("deis config:unset FOO -a %s" , appName )
74+ Expect (err ).NotTo (HaveOccurred ())
75+ Expect (out ).NotTo (ContainSubstring ("FOO" ))
4376 })
4477
4578 XIt ("can pull the configuration to an .env file" , func () {
0 commit comments